summaryrefslogtreecommitdiffstats
path: root/examples/game_of_life/src/style.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/game_of_life/src/style.rs')
-rw-r--r--examples/game_of_life/src/style.rs189
1 files changed, 0 insertions, 189 deletions
diff --git a/examples/game_of_life/src/style.rs b/examples/game_of_life/src/style.rs
deleted file mode 100644
index be9a0e96..00000000
--- a/examples/game_of_life/src/style.rs
+++ /dev/null
@@ -1,189 +0,0 @@
-use iced::{button, container, pick_list, slider, Background, Color};
-
-const ACTIVE: Color = Color::from_rgb(
- 0x72 as f32 / 255.0,
- 0x89 as f32 / 255.0,
- 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,
- 0xC4 as f32 / 255.0,
-);
-
-const BACKGROUND: Color = Color::from_rgb(
- 0x2F as f32 / 255.0,
- 0x31 as f32 / 255.0,
- 0x36 as f32 / 255.0,
-);
-
-pub struct Container;
-
-impl container::StyleSheet for Container {
- fn style(&self) -> container::Style {
- container::Style {
- background: Some(Background::Color(Color::from_rgb8(
- 0x36, 0x39, 0x3F,
- ))),
- text_color: Some(Color::WHITE),
- ..container::Style::default()
- }
- }
-}
-
-pub struct Button;
-
-impl button::StyleSheet for Button {
- fn active(&self) -> button::Style {
- button::Style {
- background: Some(Background::Color(ACTIVE)),
- border_radius: 3.0,
- text_color: Color::WHITE,
- ..button::Style::default()
- }
- }
-
- fn hovered(&self) -> button::Style {
- button::Style {
- background: Some(Background::Color(HOVERED)),
- text_color: Color::WHITE,
- ..self.active()
- }
- }
-
- fn pressed(&self) -> button::Style {
- button::Style {
- border_width: 1.0,
- border_color: Color::WHITE,
- ..self.hovered()
- }
- }
-}
-
-pub struct Clear;
-
-impl button::StyleSheet for Clear {
- fn active(&self) -> button::Style {
- button::Style {
- background: Some(Background::Color(DESTRUCTIVE)),
- border_radius: 3.0,
- 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.0,
- border_color: Color::WHITE,
- ..self.hovered()
- }
- }
-}
-
-pub struct Slider;
-
-impl slider::StyleSheet for Slider {
- fn active(&self) -> slider::Style {
- slider::Style {
- rail_colors: (ACTIVE, Color { a: 0.1, ..ACTIVE }),
- handle: slider::Handle {
- shape: slider::HandleShape::Circle { radius: 9.0 },
- color: ACTIVE,
- border_width: 0.0,
- border_color: Color::TRANSPARENT,
- },
- }
- }
-
- fn hovered(&self) -> slider::Style {
- let active = self.active();
-
- slider::Style {
- handle: slider::Handle {
- color: HOVERED,
- ..active.handle
- },
- ..active
- }
- }
-
- fn dragging(&self) -> slider::Style {
- let active = self.active();
-
- slider::Style {
- handle: slider::Handle {
- color: Color::from_rgb(0.85, 0.85, 0.85),
- ..active.handle
- },
- ..active
- }
- }
-}
-
-pub struct PickList;
-
-impl pick_list::StyleSheet for PickList {
- fn menu(&self) -> pick_list::Menu {
- pick_list::Menu {
- text_color: Color::WHITE,
- background: BACKGROUND.into(),
- border_width: 1.0,
- border_color: Color {
- a: 0.7,
- ..Color::BLACK
- },
- selected_background: Color {
- a: 0.5,
- ..Color::BLACK
- }
- .into(),
- selected_text_color: Color::WHITE,
- }
- }
-
- fn active(&self) -> pick_list::Style {
- pick_list::Style {
- text_color: Color::WHITE,
- background: BACKGROUND.into(),
- border_width: 1.0,
- border_color: Color {
- a: 0.6,
- ..Color::BLACK
- },
- border_radius: 2.0,
- icon_size: 0.5,
- ..pick_list::Style::default()
- }
- }
-
- fn hovered(&self) -> pick_list::Style {
- let active = self.active();
-
- pick_list::Style {
- border_color: Color {
- a: 0.9,
- ..Color::BLACK
- },
- ..active
- }
- }
-}