Add Theme selector to layout example

This commit is contained in:
Héctor Ramón Jiménez 2024-01-10 08:15:05 +01:00
parent d76705df29
commit 3850a46db6
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
5 changed files with 60 additions and 21 deletions

View file

@ -53,13 +53,16 @@ impl Sandbox for Styling {
self.theme = match theme {
ThemeType::Light => Theme::Light,
ThemeType::Dark => Theme::Dark,
ThemeType::Custom => Theme::custom(theme::Palette {
background: Color::from_rgb(1.0, 0.9, 1.0),
text: Color::BLACK,
primary: Color::from_rgb(0.5, 0.5, 0.0),
success: Color::from_rgb(0.0, 1.0, 0.0),
danger: Color::from_rgb(1.0, 0.0, 0.0),
}),
ThemeType::Custom => Theme::custom(
String::from("Custom"),
theme::Palette {
background: Color::from_rgb(1.0, 0.9, 1.0),
text: Color::BLACK,
primary: Color::from_rgb(0.5, 0.5, 0.0),
success: Color::from_rgb(0.0, 1.0, 0.0),
danger: Color::from_rgb(1.0, 0.0, 0.0),
},
),
}
}
Message::InputChanged(value) => self.input_value = value,