diff options
author | 2024-03-08 14:00:28 +0100 | |
---|---|---|
committer | 2024-03-08 14:00:28 +0100 | |
commit | edf7d7ca7593f660f4b15f154257471c26df87de (patch) | |
tree | 7cee3cbfbeb2ae5145f1bf6087b61fce4cbed8c9 /core/src/background.rs | |
parent | 2074757cdc65ec16eeb1c7a12a5ff3bb5ed00859 (diff) | |
parent | 8919f2593e39f76b273513e959fa6d5ffb78fde2 (diff) | |
download | iced-edf7d7ca7593f660f4b15f154257471c26df87de.tar.gz iced-edf7d7ca7593f660f4b15f154257471c26df87de.tar.bz2 iced-edf7d7ca7593f660f4b15f154257471c26df87de.zip |
Merge pull request #2312 from iced-rs/theming-reloaded
Theming reloaded
Diffstat (limited to 'core/src/background.rs')
-rw-r--r-- | core/src/background.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/background.rs b/core/src/background.rs index 347c52c0..eb4b5021 100644 --- a/core/src/background.rs +++ b/core/src/background.rs @@ -11,6 +11,19 @@ pub enum Background { // TODO: Add image variant } +impl Background { + /// Scales the the alpha channel of the [`Background`] by the given + /// factor. + pub fn scale_alpha(self, factor: f32) -> Self { + match self { + Self::Color(color) => Self::Color(color.scale_alpha(factor)), + Self::Gradient(gradient) => { + Self::Gradient(gradient.scale_alpha(factor)) + } + } + } +} + impl From<Color> for Background { fn from(color: Color) -> Self { Background::Color(color) |