Introduce specific types for each palette::Extended field
We will have more control over color calculations for each semantic purpose this way.
This commit is contained in:
parent
d5bc610d01
commit
d988d813d7
4 changed files with 142 additions and 88 deletions
|
|
@ -12,8 +12,8 @@ use iced::theme::{self, Theme};
|
|||
use iced::time;
|
||||
use iced::window;
|
||||
use iced::{
|
||||
Alignment, Application, Checkbox, Column, Command, Container, Element,
|
||||
Length, Row, Settings, Subscription, Text,
|
||||
Alignment, Application, Checkbox, Column, Command, Element, Length, Row,
|
||||
Settings, Subscription, Text,
|
||||
};
|
||||
use preset::Preset;
|
||||
use std::time::{Duration, Instant};
|
||||
|
|
@ -143,20 +143,19 @@ impl Application for GameOfLife {
|
|||
self.grid.preset(),
|
||||
);
|
||||
|
||||
let content = Column::new()
|
||||
Column::new()
|
||||
.push(
|
||||
self.grid
|
||||
.view()
|
||||
.map(move |message| Message::Grid(message, version)),
|
||||
)
|
||||
.push(controls);
|
||||
|
||||
Container::new(content)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
.style(style::Container)
|
||||
.push(controls)
|
||||
.into()
|
||||
}
|
||||
|
||||
fn theme(&self) -> Theme {
|
||||
Theme::Dark
|
||||
}
|
||||
}
|
||||
|
||||
mod grid {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use iced::{container, pick_list, Background, Color};
|
||||
use iced::{pick_list, Color};
|
||||
|
||||
const BACKGROUND: Color = Color::from_rgb(
|
||||
0x2F as f32 / 255.0,
|
||||
|
|
@ -6,20 +6,6 @@ const BACKGROUND: Color = Color::from_rgb(
|
|||
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 PickList;
|
||||
|
||||
impl pick_list::StyleSheet for PickList {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue