Coverage for src/ui/theme.py: 77%
31 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-06-05 22:56 -0700
« prev ^ index » next coverage.py v7.8.0, created at 2025-06-05 22:56 -0700
1"""
2Theme constants for the Chuck TUI application.
4This module provides standardized color and style constants to ensure
5consistent visual presentation across the application.
6"""
8from typing import Dict
10# Primary color scheme
11CHUCK_LOGO = "#0bb9c9"
12DIALOG_BORDER = "#ABB222"
13MESSAGE_LIGHT = "#54d3de"
14MESSAGE_STANDARD = "#0bb9c9"
15INFO = "#75c163"
16ERROR = "#FF504A"
17SUCCESS = "#75c163"
18TABLE_HEADER = "#54d3de"
19TABLE_BORDER = "#00a0b2"
21# Additional semantic colors
22WARNING = "#75c163"
23NEUTRAL = "white"
24INACTIVE = "#C2CBD1"
25HIGHLIGHT = "bold white"
27# Style combinations
28TITLE_STYLE = f"bold {TABLE_HEADER}"
29HEADER_STYLE = "bold"
30ERROR_STYLE = f"bold {ERROR}"
31SUCCESS_STYLE = f"bold {SUCCESS}"
32INFO_STYLE = f"bold {INFO}"
33WARNING_STYLE = f"bold {WARNING}"
35# Compound styles for specific UI elements
36TABLE_TITLE_STYLE = TITLE_STYLE
37TABLE_BORDER_STYLE = TABLE_BORDER
39# Status styling map - for consistent status indicators across the application
40STATUS_STYLES: Dict[str, str] = {
41 "active": SUCCESS,
42 "running": SUCCESS,
43 "available": SUCCESS,
44 "ready": SUCCESS,
45 "stopped": NEUTRAL,
46 "inactive": NEUTRAL,
47 "paused": WARNING,
48 "error": ERROR,
49 "failed": ERROR,
50 "terminated": ERROR,
51 "unknown": WARNING,
52}
55def get_status_style(status: str) -> str:
56 """
57 Get the appropriate style for a status value.
59 Args:
60 status: The status string to style
62 Returns:
63 A Rich-compatible style string
64 """
65 status_lower = status.lower()
67 # Check exact matches first
68 if status_lower in STATUS_STYLES:
69 return STATUS_STYLES[status_lower]
71 # Check for partial matches
72 for key, style in STATUS_STYLES.items():
73 if key in status_lower:
74 return style
76 # Default style if no match
77 return NEUTRAL