Skip to main content

egui_macview/theme/
pro_accessors.rs

1//! Pro-Inspector Metric and Semantic Tag Color Accessors on [`MacTheme`].
2
3use super::MacTheme;
4use crate::tokens::{
5    MacTagLabelColors, OriginMatrixMetrics, TableActionBarMetrics, TagColorPickerMetrics,
6};
7use egui::Color32;
8
9impl MacTheme {
10    /// Returns `3x3` 9-point transform origin / anchor pin grid tokens (`metrics.control.origin_matrix`).
11    pub fn origin_matrix(&self) -> &OriginMatrixMetrics {
12        self.tokens.origin_matrix_metrics()
13    }
14
15    /// Returns macOS Finder / AppKit tag color swatch picker tokens (`metrics.control.tag_color_picker`).
16    pub fn tag_color_picker(&self) -> &TagColorPickerMetrics {
17        self.tokens.tag_color_picker_metrics()
18    }
19
20    /// Returns `NSBezelStyleSmallSquare` `[ + | - ]` table action bar tokens (`metrics.control.table_action_bar`).
21    pub fn table_action_bar(&self) -> &TableActionBarMetrics {
22        self.tokens.table_action_bar_metrics()
23    }
24
25    /// Returns the semantic tag label color token group (`color.tag_labels`).
26    pub fn tag_labels(&self) -> &MacTagLabelColors {
27        &self.tokens.colors().tag_labels
28    }
29
30    /// Returns the 11 standard semantic Finder / AppKit tag swatch colors (`Red` through `Gray`).
31    pub fn tag_label_palette(&self) -> [Color32; 11] {
32        self.tag_labels().palette_11()
33    }
34
35    /// Returns the subtle perimeter border color around each tag color swatch dot (`rgba(0, 0, 0, 0.18)`).
36    pub fn tag_swatch_border(&self) -> Color32 {
37        self.tag_labels().swatch_border.to_color32()
38    }
39
40    /// Returns the neutral `NSSlider` track background fill (`slider_track_bg`).
41    pub fn slider_track_bg(&self) -> Color32 {
42        self.colors().slider_track_bg.to_color32()
43    }
44
45    /// Returns the neutral `NSSlider` track border color (`slider_track_border`).
46    pub fn slider_track_border(&self) -> Color32 {
47        self.colors().slider_track_border.to_color32()
48    }
49
50    /// Returns the AppKit `NSSlider` tick mark stroke color (`#B8B8B8` in Light, `#666666` in Dark).
51    pub fn slider_tick_mark_color(&self) -> Color32 {
52        self.colors().slider_tick_mark.to_color32()
53    }
54
55    /// Returns the AppKit `NSSlider` thumb fill color (`slider_thumb_bg`).
56    pub fn slider_thumb_bg(&self) -> Color32 {
57        self.colors().slider_thumb_bg.to_color32()
58    }
59
60    /// Returns the AppKit `NSSlider` thumb border color (`slider_thumb_border`).
61    pub fn slider_thumb_border_color(&self) -> Color32 {
62        self.colors().slider_thumb_border.to_color32()
63    }
64
65    /// Returns the `NSBezelStyleSmallSquare` border and divider color (`table_action_bar_border`).
66    pub fn table_action_bar_border(&self) -> Color32 {
67        self.colors().box_border.to_color32()
68    }
69
70    /// Returns the active segment fill for `NSSegmentedControl` `.smallSquare` (`segmented_small_square_active_bg`).
71    pub fn segmented_small_square_active_bg(&self) -> Color32 {
72        self.colors().segmented_small_square_active_bg.to_color32()
73    }
74
75    /// Returns the inactive segment fill for `NSSegmentedControl` `.smallSquare` (`segmented_small_square_inactive_bg`).
76    pub fn segmented_small_square_inactive_bg(&self) -> Color32 {
77        self.colors().segmented_small_square_inactive_bg.to_color32()
78    }
79
80    /// Returns the AppKit `NSPopover` container surface background color (`popover_background`).
81    pub fn popover_background(&self) -> Color32 {
82        self.colors().popover_background.to_color32()
83    }
84
85    /// Returns the AppKit `NSPopover` container subtle perimeter border color (`popover_border`).
86    pub fn popover_border(&self) -> Color32 {
87        self.colors().popover_border.to_color32()
88    }
89}