diff options
author | 2020-05-02 09:27:49 +0200 | |
---|---|---|
committer | 2020-05-02 09:27:49 +0200 | |
commit | 0025b8c3f8f029d6fb7b8b5a599cc6450248aad6 (patch) | |
tree | b9fc117c9df861207ed0508d57dc43f49a4b9919 /examples/game_of_life/src/style.rs | |
parent | 916a1bfc7049867669b81f446e711021d92a4132 (diff) | |
download | iced-0025b8c3f8f029d6fb7b8b5a599cc6450248aad6.tar.gz iced-0025b8c3f8f029d6fb7b8b5a599cc6450248aad6.tar.bz2 iced-0025b8c3f8f029d6fb7b8b5a599cc6450248aad6.zip |
Display some statistics in `game_of_life`
Diffstat (limited to 'examples/game_of_life/src/style.rs')
-rw-r--r-- | examples/game_of_life/src/style.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/game_of_life/src/style.rs b/examples/game_of_life/src/style.rs index 0becb5be..d59569f2 100644 --- a/examples/game_of_life/src/style.rs +++ b/examples/game_of_life/src/style.rs @@ -6,6 +6,12 @@ const ACTIVE: Color = Color::from_rgb( 0xDA as f32 / 255.0, ); +const DESTRUCTIVE: Color = Color::from_rgb( + 0xC0 as f32 / 255.0, + 0x47 as f32 / 255.0, + 0x47 as f32 / 255.0, +); + const HOVERED: Color = Color::from_rgb( 0x67 as f32 / 255.0, 0x7B as f32 / 255.0, @@ -55,6 +61,38 @@ impl button::StyleSheet for Button { } } +pub struct Clear; + +impl button::StyleSheet for Clear { + fn active(&self) -> button::Style { + button::Style { + background: Some(Background::Color(DESTRUCTIVE)), + border_radius: 3, + text_color: Color::WHITE, + ..button::Style::default() + } + } + + fn hovered(&self) -> button::Style { + button::Style { + background: Some(Background::Color(Color { + a: 0.5, + ..DESTRUCTIVE + })), + text_color: Color::WHITE, + ..self.active() + } + } + + fn pressed(&self) -> button::Style { + button::Style { + border_width: 1, + border_color: Color::WHITE, + ..self.hovered() + } + } +} + pub struct Slider; impl slider::StyleSheet for Slider { |