from __future__ import annotations import curses class UIColors: """Color pair identifiers and helpers for the Collatz dashboard.""" HEADER = 1 SEPARATOR = 2 NUMBER = 3 LOG = 4 DOWN = 5 UP = 6 NEUTRAL = 7 FILL = 8 @classmethod def setup(cls) -> None: """Initialize all color pairs with a neutral background.""" if not curses.has_colors(): return curses.start_color() curses.use_default_colors() curses.init_pair(cls.HEADER, curses.COLOR_CYAN, -1) curses.init_pair(cls.SEPARATOR, curses.COLOR_BLUE, -1) curses.init_pair(cls.NUMBER, curses.COLOR_WHITE, -1) curses.init_pair(cls.LOG, curses.COLOR_MAGENTA, -1) curses.init_pair(cls.DOWN, curses.COLOR_RED, -1) curses.init_pair(cls.UP, curses.COLOR_GREEN, -1) curses.init_pair(cls.NEUTRAL, curses.COLOR_YELLOW, -1) curses.init_pair(cls.FILL, curses.COLOR_BLUE, -1) @staticmethod def style(pair: int, *, bold: bool = False, dim: bool = False) -> int: """Return a curses attribute with the requested style applied.""" attr = curses.color_pair(pair) if bold: attr |= curses.A_BOLD if dim: attr |= curses.A_DIM return attr