From 34ca5386b52ae56d7373ce1af7933cf9aa104b08 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Thu, 7 Mar 2024 20:15:49 +0100 Subject: Implement `with_background` for `button::Appearance` --- widget/src/button.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/widget/src/button.rs b/widget/src/button.rs index f9859353..bfda8fe3 100644 --- a/widget/src/button.rs +++ b/widget/src/button.rs @@ -411,6 +411,16 @@ pub struct Appearance { pub shadow: Shadow, } +impl Appearance { + /// Creates an [`Appearance`] with the given [`Background`]. + pub fn with_background(background: impl Into) -> Self { + Self { + background: Some(background.into()), + ..Self::default() + } + } +} + impl std::default::Default for Appearance { fn default() -> Self { Self { -- cgit