1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use super::Drawable;
use crate::attributes::IntoPaintStack;
/// Capability for configuring background paint on a node.
pub trait Background: Drawable {
/// Sets the background paint for the node.
///
/// # Arguments
/// - `value`: The background paint configuration convertible into a paint
/// stack using [`IntoPaintStack`].
///
/// # Returns
/// - [`Self`]
fn background<T>(mut self, value: T) -> Self
where
T: IntoPaintStack,
{
let background = value.into_paint_stack();
self.visual_mut().background = background.clone();
self.add_resources(background);
self
}
/// Shorthand alias for [`background`].
///
/// # Arguments
/// - `value`: The background paint configuration convertible into a paint
/// stack using [`IntoPaintStack`].
///
/// # Returns
/// - [`Self`]
///
/// [`background`]: Background::background
fn bg<T>(self, value: T) -> Self
where
T: IntoPaintStack,
{
self.background(value)
}
}