diff options
author | 2022-05-26 01:10:26 +0200 | |
---|---|---|
committer | 2022-05-26 01:10:26 +0200 | |
commit | 822a3cd04f9edeb887d85164b0b3e556c3fde6bb (patch) | |
tree | a9696674d844af5892f46daef6d36407fb076383 /style/src/theme.rs | |
parent | 3a820b45f336398c48f8bedf7b8c4b8af876efff (diff) | |
download | iced-822a3cd04f9edeb887d85164b0b3e556c3fde6bb.tar.gz iced-822a3cd04f9edeb887d85164b0b3e556c3fde6bb.tar.bz2 iced-822a3cd04f9edeb887d85164b0b3e556c3fde6bb.zip |
Let a `Theme` control the `text_color` of an application
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r-- | style/src/theme.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index e3c0efc6..1ddf97c3 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -31,12 +31,14 @@ impl Theme { impl Default for Theme { fn default() -> Self { - Self::Light + Self::Dark } } pub trait Definition { fn background_color(&self) -> Color; + + fn text_color(&self) -> Color; } impl Definition for Theme { @@ -45,6 +47,12 @@ impl Definition for Theme { palette.background.base } + + fn text_color(&self) -> Color { + let palette = self.extended_palette(); + + palette.background.text + } } #[derive(Debug, Clone, Copy, PartialEq, Eq)] |