Skip to main content

vtcode_core/ui/
theme.rs

1//! Compatibility facade for shared theme APIs.
2
3#[cfg(feature = "tui")]
4pub use vtcode_ui::theme::*;
5
6#[cfg(not(feature = "tui"))]
7mod headless_theme {
8    use anstyle::{AnsiColor, Color, Style};
9
10    /// Styles resolved from the active palette.
11    ///
12    /// Keep field-compatible with `vtcode_ui::theme::ThemeStyles`. Headless
13    /// builds have no theme runtime, so [`active_styles`] returns neutral
14    /// (unstyled) values.
15    #[derive(Clone, Debug)]
16    pub struct ThemeStyles {
17        pub info: Style,
18        pub error: Style,
19        pub warning: Style,
20        pub output: Style,
21        pub response: Style,
22        pub reasoning: Style,
23        pub tool: Style,
24        pub tool_detail: Style,
25        pub tool_output: Style,
26        pub pty_output: Style,
27        pub status: Style,
28        pub mcp: Style,
29        pub user: Style,
30        pub primary: Style,
31        pub secondary: Style,
32        pub background: Color,
33        pub foreground: Color,
34    }
35
36    /// Active styles (headless: neutral defaults, no theme runtime).
37    pub fn active_styles() -> ThemeStyles {
38        ThemeStyles {
39            info: Style::default(),
40            error: Style::default(),
41            warning: Style::default(),
42            output: Style::default(),
43            response: Style::default(),
44            reasoning: Style::default(),
45            tool: Style::default(),
46            tool_detail: Style::default(),
47            tool_output: Style::default(),
48            pty_output: Style::default(),
49            status: Style::default(),
50            mcp: Style::default(),
51            user: Style::default(),
52            primary: Style::default(),
53            secondary: Style::default(),
54            background: Color::Ansi(AnsiColor::Black),
55            foreground: Color::Ansi(AnsiColor::White),
56        }
57    }
58
59    /// Active theme id (headless: always the default theme).
60    pub fn active_theme_id() -> String {
61        vtcode_config::constants::defaults::DEFAULT_THEME.to_string()
62    }
63
64    /// Whether a theme id is light (headless: always dark).
65    pub fn is_light_theme(_theme_id: &str) -> bool {
66        false
67    }
68
69    /// Recommended syntax theme for a UI theme (headless: the default ramp,
70    /// matching the fallback arm of the TUI implementation).
71    pub fn get_syntax_theme_for_ui_theme(_ui_theme: &str) -> &'static str {
72        "base16-ocean.dark"
73    }
74}
75
76#[cfg(not(feature = "tui"))]
77pub use headless_theme::*;