Draft first-class Theme support

RFC: https://github.com/iced-rs/rfcs/pull/6
This commit is contained in:
Héctor Ramón Jiménez 2022-05-14 01:47:55 +02:00
parent 5de337f214
commit 664251f3f5
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
113 changed files with 767 additions and 878 deletions

45
style/src/theme.rs Normal file
View file

@ -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,
}
}
}