Let a Theme control the background color of an application
... and remove `Application::background_color`
This commit is contained in:
parent
2cfb307f8c
commit
03eda9b162
9 changed files with 33 additions and 79 deletions
|
|
@ -4,7 +4,7 @@ pub use self::palette::Palette;
|
|||
|
||||
use crate::button;
|
||||
|
||||
use iced_core::Background;
|
||||
use iced_core::{Background, Color};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Theme {
|
||||
|
|
@ -34,6 +34,18 @@ impl Default for Theme {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait Definition {
|
||||
fn background_color(&self) -> Color;
|
||||
}
|
||||
|
||||
impl Definition for Theme {
|
||||
fn background_color(&self) -> Color {
|
||||
let palette = self.extended_palette();
|
||||
|
||||
palette.background.base
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Button {
|
||||
Primary,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue