summaryrefslogtreecommitdiffstats
path: root/style
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-05-25 05:01:18 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-05-25 05:01:18 +0200
commit03eda9b162012c503ead649e5ccb95b7ef1d10ed (patch)
treea134dbab97011c0a465f4527d2ae0bb771f51554 /style
parent2cfb307f8c3927a0876c6b754a5d7d673b9edfee (diff)
downloadiced-03eda9b162012c503ead649e5ccb95b7ef1d10ed.tar.gz
iced-03eda9b162012c503ead649e5ccb95b7ef1d10ed.tar.bz2
iced-03eda9b162012c503ead649e5ccb95b7ef1d10ed.zip
Let a `Theme` control the background color of an application
... and remove `Application::background_color`
Diffstat (limited to 'style')
-rw-r--r--style/src/theme.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs
index 91a9e921..16f24923 100644
--- a/style/src/theme.rs
+++ b/style/src/theme.rs
@@ -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,