feat(divider): add functions for divider style variants of a Rule

This commit is contained in:
Michael Aaron Murphy 2023-01-24 21:13:50 +01:00 committed by Michael Murphy
parent b3a3c9c29a
commit 9a095e4d94
4 changed files with 42 additions and 32 deletions

View file

@ -652,6 +652,8 @@ impl progress_bar::StyleSheet for Theme {
#[derive(Clone, Copy)]
pub enum Rule {
Default,
LightDivider,
HeavyDivider,
Custom(fn(&Theme) -> rule::Appearance),
}
@ -674,6 +676,24 @@ impl rule::StyleSheet for Theme {
radius: 0.0,
fill_mode: rule::FillMode::Full,
},
Rule::LightDivider => {
let cosmic = &self.cosmic().primary;
rule::Appearance {
color: cosmic.divider.into(),
width: 1,
radius: 0.0,
fill_mode: rule::FillMode::Padded(10),
}
}
Rule::HeavyDivider => {
let cosmic = &self.cosmic().primary;
rule::Appearance {
color: cosmic.divider.into(),
width: 4,
radius: 4.0,
fill_mode: rule::FillMode::Full,
}
}
Rule::Custom(f) => f(self),
}
}