Skip to main content

fresh/app/types/
theme.rs

1/// Lightweight per-cell theme key provenance recorded during rendering.
2/// Stored in `ChromeLayout::cell_theme_map` so the theme inspector popup
3/// can look up the exact keys used for any screen position.
4#[derive(Debug, Clone, Default)]
5pub struct CellThemeInfo {
6    /// Foreground theme key (e.g. "syntax.keyword", "editor.fg")
7    pub fg_key: Option<&'static str>,
8    /// Background theme key (e.g. "editor.bg", "diagnostic.warning_bg")
9    pub bg_key: Option<&'static str>,
10    /// Short region label (e.g. "Line Numbers", "Editor Content")
11    pub region: &'static str,
12    /// Dynamic region suffix (e.g. syntax category display name appended to "Syntax: ")
13    pub syntax_category: Option<&'static str>,
14}
15
16/// Information about which theme key(s) style a specific screen position.
17/// Used by the Ctrl+Right-Click theme inspector popup.
18#[derive(Debug, Clone)]
19pub struct ThemeKeyInfo {
20    /// The foreground theme key path (e.g., "syntax.keyword", "editor.fg")
21    pub fg_key: Option<String>,
22    /// The background theme key path (e.g., "editor.bg", "editor.selection_bg")
23    pub bg_key: Option<String>,
24    /// Human-readable description of the UI region
25    pub region: String,
26    /// The actual foreground color value currently applied
27    pub fg_color: Option<ratatui::style::Color>,
28    /// The actual background color value currently applied
29    pub bg_color: Option<ratatui::style::Color>,
30    /// For syntax highlights: the HighlightCategory display name
31    pub syntax_category: Option<String>,
32}
33
34/// State for the theme inspector popup (Ctrl+Right-Click)
35#[derive(Debug, Clone)]
36pub struct ThemeInfoPopup {
37    /// Screen position where popup appears (x, y)
38    pub position: (u16, u16),
39    /// Resolved theme key information
40    pub info: ThemeKeyInfo,
41    /// Whether the "Open in Theme Editor" button is highlighted (mouse hover)
42    pub button_highlighted: bool,
43}