Implement with_background for button::Appearance

This commit is contained in:
Héctor Ramón Jiménez 2024-03-07 20:15:49 +01:00
parent e11776055d
commit 34ca5386b5
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -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 {