diff options
author | 2022-05-14 01:47:55 +0200 | |
---|---|---|
committer | 2022-05-14 01:56:32 +0200 | |
commit | 664251f3f5c7b76f69a97683af1468094bba887f (patch) | |
tree | f43a495036ed117ce5dbb479c62652d872a6d273 /style/src/theme.rs | |
parent | 5de337f214530faab1d5fe47784afd7006c3f7f0 (diff) | |
download | iced-664251f3f5c7b76f69a97683af1468094bba887f.tar.gz iced-664251f3f5c7b76f69a97683af1468094bba887f.tar.bz2 iced-664251f3f5c7b76f69a97683af1468094bba887f.zip |
Draft first-class `Theme` support
RFC: https://github.com/iced-rs/rfcs/pull/6
Diffstat (limited to '')
-rw-r--r-- | style/src/theme.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs new file mode 100644 index 00000000..7d420c8a --- /dev/null +++ b/style/src/theme.rs @@ -0,0 +1,45 @@ +use crate::button; + +use iced_core::{Color, Vector}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Theme { + Light, + Dark, +} + +impl Default for Theme { + fn default() -> Self { + Self::Light + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum Button { + Primary, + Secondary, + Positive, + Destructive, + Text, +} + +impl Default for Button { + fn default() -> Self { + Self::Primary + } +} + +impl button::StyleSheet for Theme { + type Variant = Button; + + fn active(&self, _variant: Self::Variant) -> button::Style { + button::Style { + shadow_offset: Vector::default(), + background: None, + border_radius: 0.0, + border_width: 0.0, + border_color: Color::TRANSPARENT, + text_color: Color::BLACK, + } + } +} |