summaryrefslogtreecommitdiffstats
path: root/widget/src
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-07 20:15:49 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-07 20:15:49 +0100
commit34ca5386b52ae56d7373ce1af7933cf9aa104b08 (patch)
tree319da140d29256b0293d1773f5e1eac6b34d0fc8 /widget/src
parente11776055dd6c79298c17e00a86ba43aba917bba (diff)
downloadiced-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.rs10
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 {