From ef162b8e16ba4493e05c169cd56c7b9f77f0fda5 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Sun, 19 Jul 2026 04:48:42 +0200 Subject: [PATCH] feat(icon): add opacity method --- src/widget/icon/mod.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widget/icon/mod.rs b/src/widget/icon/mod.rs index 031b4b0c..5685e448 100644 --- a/src/widget/icon/mod.rs +++ b/src/widget/icon/mod.rs @@ -25,6 +25,7 @@ pub fn icon(handle: Handle) -> Icon { handle, height: None, size: 16, + opacity: 1.0, class: crate::theme::Svg::default(), rotation: None, width: None, @@ -45,6 +46,7 @@ pub struct Icon { class: crate::theme::Svg, #[setters(skip)] pub(super) size: u16, + opacity: f32, content_fit: ContentFit, #[setters(strip_option)] width: Option, @@ -65,7 +67,6 @@ impl Icon { None } - #[must_use] pub fn size(mut self, size: u16) -> Self { self.size = size; self @@ -83,6 +84,7 @@ impl Icon { self.height .unwrap_or_else(|| Length::Fixed(f32::from(self.size))), ) + .opacity(self.opacity) .rotation(self.rotation.unwrap_or_default()) .content_fit(self.content_fit) .into() @@ -99,6 +101,7 @@ impl Icon { self.height .unwrap_or_else(|| Length::Fixed(f32::from(self.size))), ) + .opacity(self.opacity) .rotation(self.rotation.unwrap_or_default()) .content_fit(self.content_fit) .symbolic(self.handle.symbolic)