Skip to main content

agg_gui/widgets/
button_theme.rs

1//! Visual theme for [`super::Button`] — colours, corner radius, focus ring.
2//!
3//! Split out of `button.rs` so the parent stays under the 800-line cap.
4
5use crate::color::Color;
6
7/// A theme for [`super::Button`] visual states.
8#[derive(Clone, Copy, Debug, PartialEq)]
9pub struct ButtonTheme {
10    pub background: Color,
11    pub background_hovered: Color,
12    pub background_pressed: Color,
13    pub label_color: Color,
14    pub border_radius: f64,
15    pub focus_ring_color: Color,
16    pub focus_ring_width: f64,
17}
18
19impl Default for ButtonTheme {
20    fn default() -> Self {
21        Self {
22            background: Color::rgb(0.22, 0.45, 0.88),
23            background_hovered: Color::rgb(0.30, 0.52, 0.92),
24            background_pressed: Color::rgb(0.16, 0.36, 0.72),
25            label_color: Color::white(),
26            border_radius: 6.0,
27            focus_ring_color: Color::rgba(0.22, 0.45, 0.88, 0.55),
28            focus_ring_width: 2.5,
29        }
30    }
31}