Simplify theming for Button widget

This commit is contained in:
Héctor Ramón Jiménez 2024-03-04 20:42:37 +01:00
parent db92e1c942
commit f4a4845ddb
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
16 changed files with 306 additions and 412 deletions

View file

@ -11,6 +11,19 @@ pub enum Background {
// TODO: Add image variant
}
impl Background {
/// Increases the translucency of the [`Background`]
/// by the given factor.
pub fn transparentize(self, factor: f32) -> Self {
match self {
Self::Color(color) => Self::Color(color.transparentize(factor)),
Self::Gradient(gradient) => {
Self::Gradient(gradient.transparentize(factor))
}
}
}
}
impl From<Color> for Background {
fn from(color: Color) -> Self {
Background::Color(color)