diff options
author | 2022-11-03 03:27:55 +0100 | |
---|---|---|
committer | 2022-11-03 03:27:55 +0100 | |
commit | df7877767567cc0c7f48d2d6da4680a55f0f7b6d (patch) | |
tree | 66773a33f34b2d31b10d3d1bee69e264760160a0 | |
parent | f04336dd5cf5e15bbcf48cd54b7e97c569c07a92 (diff) | |
download | iced-df7877767567cc0c7f48d2d6da4680a55f0f7b6d.tar.gz iced-df7877767567cc0c7f48d2d6da4680a55f0f7b6d.tar.bz2 iced-df7877767567cc0c7f48d2d6da4680a55f0f7b6d.zip |
Box `Custom` in `Theme`
-rw-r--r-- | examples/scrollable/src/main.rs | 2 | ||||
-rw-r--r-- | examples/styling/src/main.rs | 2 | ||||
-rw-r--r-- | style/src/theme.rs | 8 |
3 files changed, 6 insertions, 6 deletions
diff --git a/examples/scrollable/src/main.rs b/examples/scrollable/src/main.rs index 7e1716cf..6eba34e2 100644 --- a/examples/scrollable/src/main.rs +++ b/examples/scrollable/src/main.rs @@ -205,7 +205,7 @@ impl Application for ScrollableDemo { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } } diff --git a/examples/styling/src/main.rs b/examples/styling/src/main.rs index 6bcfa5f1..e16860ad 100644 --- a/examples/styling/src/main.rs +++ b/examples/styling/src/main.rs @@ -159,6 +159,6 @@ impl Sandbox for Styling { } fn theme(&self) -> Theme { - self.theme + self.theme.clone() } } diff --git a/style/src/theme.rs b/style/src/theme.rs index 723c60d6..a253e990 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -21,19 +21,19 @@ use crate::toggler; use iced_core::{Background, Color}; -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, PartialEq)] pub enum Theme { Light, Dark, - Custom(Custom), + Custom(Box<Custom>), } impl Theme { pub fn custom(palette: Palette) -> Self { - Self::Custom(Custom::new(palette)) + Self::Custom(Box::new(Custom::new(palette))) } - pub fn palette(self) -> Palette { + pub fn palette(&self) -> Palette { match self { Self::Light => Palette::LIGHT, Self::Dark => Palette::DARK, |