diff options
Diffstat (limited to '')
-rw-r--r-- | src/pure/sandbox.rs | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/pure/sandbox.rs b/src/pure/sandbox.rs index fbd1d7a8..a58cace7 100644 --- a/src/pure/sandbox.rs +++ b/src/pure/sandbox.rs @@ -1,5 +1,5 @@ use crate::pure; -use crate::{Color, Command, Error, Settings, Subscription}; +use crate::{Command, Error, Settings, Subscription, Theme}; /// A pure version of [`Sandbox`]. /// @@ -34,11 +34,14 @@ pub trait Sandbox { /// These widgets can produce __messages__ based on user interaction. fn view(&self) -> pure::Element<'_, Self::Message>; - /// Returns the background color of the [`Sandbox`]. + /// Returns the current [`Theme`] of the [`Sandbox`]. /// - /// By default, it returns [`Color::WHITE`]. - fn background_color(&self) -> Color { - Color::WHITE + /// If you want to use your own custom theme type, you will have to use an + /// [`Application`]. + /// + /// By default, it returns [`Theme::default`]. + fn theme(&self) -> Theme { + Theme::default() } /// Returns the scale factor of the [`Sandbox`]. @@ -82,6 +85,7 @@ where type Executor = iced_futures::backend::null::Executor; type Flags = (); type Message = T::Message; + type Theme = Theme; fn new(_flags: ()) -> (Self, Command<T::Message>) { (T::new(), Command::none()) @@ -97,16 +101,16 @@ where Command::none() } - fn subscription(&self) -> Subscription<T::Message> { - Subscription::none() - } - fn view(&self) -> pure::Element<'_, T::Message> { T::view(self) } - fn background_color(&self) -> Color { - T::background_color(self) + fn theme(&self) -> Self::Theme { + T::theme(self) + } + + fn subscription(&self) -> Subscription<T::Message> { + Subscription::none() } fn scale_factor(&self) -> f64 { |