sequoia_style/
focus_ring_style.rs1use sequoia_core::Color;
2
3#[derive(Clone, Copy, Debug, Default, PartialEq)]
4pub struct FocusRingStyle {
5 pub color: Option<Color>,
6 pub width: Option<f32>,
7 pub offset: Option<f32>,
8 pub radius: Option<f32>,
9}
10
11impl FocusRingStyle {
12 pub const fn new() -> Self {
13 Self {
14 color: None,
15 width: None,
16 offset: None,
17 radius: None,
18 }
19 }
20
21 pub const fn color(mut self, color: Color) -> Self {
22 self.color = Some(color);
23 self
24 }
25
26 pub const fn width(mut self, px: f32) -> Self {
27 self.width = Some(px);
28 self
29 }
30
31 pub const fn offset(mut self, px: f32) -> Self {
32 self.offset = Some(px);
33 self
34 }
35
36 pub const fn radius(mut self, radius: f32) -> Self {
37 self.radius = Some(radius);
38 self
39 }
40}
41
42#[cfg(test)]
43mod tests {
44 use super::*;
45
46 #[test]
47 fn const_composition_keeps_base() {
48 const CUSTOM: FocusRingStyle = FocusRingStyle::new().width(2.0);
49 assert_eq!(CUSTOM.width, Some(2.0));
50 assert_eq!(CUSTOM.color, None);
51 }
52}