feat: SVG styling with icon fill color

This commit is contained in:
Michael Aaron Murphy 2022-11-16 17:42:41 +01:00 committed by Héctor Ramón Jiménez
parent 0249640213
commit 75ae0de9bd
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
7 changed files with 137 additions and 22 deletions

View file

@ -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;