"""Web UI color themes aligned with the CLI TUI palettes.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class WebTheme: name: str bg: str panel: str bg_alt: str accent: str fg: str dim: str ok: str tool: str border: str hf_yellow: str = "#FFD21E" WEB_THEMES: list[WebTheme] = [ WebTheme("smol-dark", "#0b1020", "#111827", "#1e293b", "#7c3aed", "#e2e8f0", "#64748b", "#34d399", "#a78bfa", "#334155"), WebTheme("tokyo", "#1a1b26", "#24283b", "#1f2335", "#7dcfff", "#c0caf5", "#565f89", "#bb9af7", "#7dcfff", "#414868"), WebTheme("gruvbox", "#282828", "#32302f", "#3c3836", "#fe8019", "#ebdbb2", "#928374", "#b8bb26", "#83a598", "#504945"), WebTheme("mono", "#161616", "#1e1e1e", "#222222", "#e0e0e0", "#c0c0c0", "#707070", "#ffffff", "#a0a0a0", "#404040"), WebTheme("catppuccin", "#1e1e2e", "#313244", "#313244", "#cba6f7", "#cdd6f4", "#6c7086", "#a6e3a1", "#89b4fa", "#45475a"), WebTheme("nord", "#2e3440", "#3b4252", "#3b4252", "#88c0d0", "#eceff4", "#4c566a", "#a3be8c", "#81a1c1", "#3b4252"), WebTheme("dracula", "#282a36", "#44475a", "#282a36", "#bd93f9", "#f8f8f2", "#6272a4", "#50fa7b", "#8be9fd", "#44475a"), WebTheme("solarized", "#002b36", "#073642", "#073642", "#268bd2", "#839496", "#586e75", "#859900", "#2aa198", "#073642"), ] def theme_names() -> list[str]: return [t.name for t in WEB_THEMES] def theme_by_name(name: str) -> WebTheme: for t in WEB_THEMES: if t.name == name: return t return WEB_THEMES[0] def theme_at(index: int) -> WebTheme: return WEB_THEMES[index % len(WEB_THEMES)] def theme_css_vars() -> str: """Per-theme CSS variable overrides for .sc-tui-shell[data-theme=...].""" blocks: list[str] = [] for t in WEB_THEMES: blocks.append( f'.sc-tui-shell[data-theme="{t.name}"] {{' f" --sc-bg:{t.bg}; --sc-panel:{t.panel}; --sc-bg-alt:{t.bg_alt};" f" --sc-accent:{t.accent}; --sc-fg:{t.fg}; --sc-dim:{t.dim};" f" --sc-ok:{t.ok}; --sc-tool:{t.tool}; --sc-border:{t.border};" f" --hf-yellow:{t.hf_yellow}; }}" ) return "\n".join(blocks)