summaryrefslogtreecommitdiffstats
path: root/core/src/background.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2024-03-08 14:00:28 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-08 14:00:28 +0100
commitedf7d7ca7593f660f4b15f154257471c26df87de (patch)
tree7cee3cbfbeb2ae5145f1bf6087b61fce4cbed8c9 /core/src/background.rs
parent2074757cdc65ec16eeb1c7a12a5ff3bb5ed00859 (diff)
parent8919f2593e39f76b273513e959fa6d5ffb78fde2 (diff)
downloadiced-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.rs13
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)