diff options
author | 2024-03-07 20:15:49 +0100 | |
---|---|---|
committer | 2024-03-07 20:15:49 +0100 | |
commit | 34ca5386b52ae56d7373ce1af7933cf9aa104b08 (patch) | |
tree | 319da140d29256b0293d1773f5e1eac6b34d0fc8 /widget/src | |
parent | e11776055dd6c79298c17e00a86ba43aba917bba (diff) | |
download | iced-34ca5386b52ae56d7373ce1af7933cf9aa104b08.tar.gz iced-34ca5386b52ae56d7373ce1af7933cf9aa104b08.tar.bz2 iced-34ca5386b52ae56d7373ce1af7933cf9aa104b08.zip |
Implement `with_background` for `button::Appearance`
Diffstat (limited to 'widget/src')
-rw-r--r-- | widget/src/button.rs | 10 |
1 files changed, 10 insertions, 0 deletions
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<Background>) -> Self { + Self { + background: Some(background.into()), + ..Self::default() + } + } +} + impl std::default::Default for Appearance { fn default() -> Self { Self { |