diff options
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 { |