""" CLI theme configuration. Centralized color and style definitions. """ from dataclasses import dataclass from functools import lru_cache from rich.console import Console from rich.theme import Theme @dataclass(frozen=True) class ThemeColors: """Color palette for the CLI.""" # Semantic colors info: str = "steel_blue" warning: str = "dark_orange" error: str = "red3" success: str = "sea_green3" # UI elements prompt: str = "steel_blue bold" title: str = "steel_blue bold" path: str = "steel_blue underline" code: str = "sea_green3" highlight: str = "medium_purple1" dim: str = "dim white" # Panel borders border_default: str = "steel_blue" border_success: str = "sea_green3" border_error: str = "red3" border_warning: str = "dark_orange" @dataclass(frozen=True) class ThemeConfig: """Complete theme configuration.""" colors: ThemeColors = ThemeColors() spinner: str = "dots" syntax_theme: str = "monokai" def to_rich_theme_dict(self) -> dict[str, str]: """Convert to Rich theme dictionary.""" return { "info": self.colors.info, "warning": self.colors.warning, "error": self.colors.error, "success": self.colors.success, "prompt": self.colors.prompt, "title": self.colors.title, "path": self.colors.path, "code": self.colors.code, "highlight": self.colors.highlight, "dim": self.colors.dim, } DEFAULT_THEME = ThemeConfig() def get_theme() -> ThemeConfig: """Get the current theme configuration.""" return DEFAULT_THEME @lru_cache def get_console() -> Console: """Get the shared console instance with theme applied.""" theme = get_theme() rich_theme = Theme(theme.to_rich_theme_dict()) return Console(theme=rich_theme)