Box Custom in Theme
This commit is contained in:
parent
f04336dd5c
commit
df78777675
3 changed files with 6 additions and 6 deletions
|
|
@ -205,7 +205,7 @@ impl Application for ScrollableDemo {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn theme(&self) -> Theme {
|
fn theme(&self) -> Theme {
|
||||||
self.theme
|
self.theme.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,6 @@ impl Sandbox for Styling {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn theme(&self) -> Theme {
|
fn theme(&self) -> Theme {
|
||||||
self.theme
|
self.theme.clone()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,19 +21,19 @@ use crate::toggler;
|
||||||
|
|
||||||
use iced_core::{Background, Color};
|
use iced_core::{Background, Color};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, PartialEq)]
|
||||||
pub enum Theme {
|
pub enum Theme {
|
||||||
Light,
|
Light,
|
||||||
Dark,
|
Dark,
|
||||||
Custom(Custom),
|
Custom(Box<Custom>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Theme {
|
impl Theme {
|
||||||
pub fn custom(palette: Palette) -> Self {
|
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 {
|
match self {
|
||||||
Self::Light => Palette::LIGHT,
|
Self::Light => Palette::LIGHT,
|
||||||
Self::Dark => Palette::DARK,
|
Self::Dark => Palette::DARK,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue