Display some statistics in game_of_life

This commit is contained in:
Héctor Ramón Jiménez 2020-05-02 09:27:49 +02:00
parent 916a1bfc70
commit 0025b8c3f8
2 changed files with 119 additions and 23 deletions

View file

@ -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 {