diff options
Diffstat (limited to 'style/src/theme.rs')
-rw-r--r-- | style/src/theme.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/style/src/theme.rs b/style/src/theme.rs index dde0df5d..d825b086 100644 --- a/style/src/theme.rs +++ b/style/src/theme.rs @@ -16,6 +16,7 @@ use crate::radio; use crate::rule; use crate::scrollable; use crate::slider; +use crate::svg; use crate::text; use crate::text_input; use crate::toggler; @@ -797,6 +798,29 @@ impl From<fn(&Theme) -> rule::Appearance> for Rule { } } +/** + * SVG + */ +#[derive(Default, Clone, Copy)] +pub enum Svg { + /// No filtering to the rendered SVG. + #[default] + Default, + /// Apply custom filtering to the SVG. + Custom(fn(&Theme) -> svg::Appearance), +} + +impl svg::StyleSheet for Theme { + type Style = Svg; + + fn appearance(&self, style: Self::Style) -> svg::Appearance { + match style { + Svg::Default => Default::default(), + Svg::Custom(appearance) => appearance(self), + } + } +} + impl rule::StyleSheet for Theme { type Style = Rule; |