feat: Themable SVGs, applied to window controls
This commit is contained in:
parent
947532413a
commit
4a899189e6
4 changed files with 35 additions and 2 deletions
|
|
@ -15,6 +15,7 @@ use iced_style::radio;
|
|||
use iced_style::rule;
|
||||
use iced_style::scrollable;
|
||||
use iced_style::slider;
|
||||
use iced_style::svg;
|
||||
use iced_style::text;
|
||||
use iced_style::text_input;
|
||||
use iced_style::toggler;
|
||||
|
|
@ -665,6 +666,31 @@ impl scrollable::StyleSheet for Theme {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#[derive(Default, Clone, Copy)]
|
||||
pub enum Svg {
|
||||
Custom(fn(&Theme) -> svg::Appearance),
|
||||
#[default]
|
||||
Default,
|
||||
Accent,
|
||||
}
|
||||
|
||||
impl svg::StyleSheet for Theme {
|
||||
type Style = Svg;
|
||||
|
||||
fn appearance(&self, style: Self::Style) -> svg::Appearance {
|
||||
let cosmic = self.cosmic();
|
||||
|
||||
match style {
|
||||
Svg::Default => Default::default(),
|
||||
Svg::Custom(appearance) => appearance(self),
|
||||
Svg::Accent => svg::Appearance {
|
||||
fill: Some(cosmic.accent.base.into()),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Text
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue