diff --git a/kittens/tui/operations.py b/kittens/tui/operations.py index 94e28d6d0..3f64a67a7 100644 --- a/kittens/tui/operations.py +++ b/kittens/tui/operations.py @@ -166,11 +166,8 @@ def scroll_screen(amt: int = 1) -> str: return '\033[' + str(abs(amt)) + ('T' if amt < 0 else 'S') -STANDARD_COLORS = {name: i for i, name in enumerate( - 'black red green yellow blue magenta cyan gray'.split())} -STANDARD_COLORS['white'] = STANDARD_COLORS['gray'] -UNDERLINE_STYLES = {name: i + 1 for i, name in enumerate( - 'straight double curly dotted dashed'.split())} +STANDARD_COLORS = {'black': 0, 'red': 1, 'green': 2, 'yellow': 3, 'blue': 4, 'magenta': 5, 'cyan': 6, 'gray': 7, 'white': 7} +UNDERLINE_STYLES = {'straight': 1, 'double': 2, 'curly': 3, 'dotted': 4, 'dashed': 5} ColorSpec = Union[int, str, Color] diff --git a/kitty/options/utils.py b/kitty/options/utils.py index 8495c77e7..a0de71533 100644 --- a/kitty/options/utils.py +++ b/kitty/options/utils.py @@ -500,18 +500,14 @@ def scrollback_pager_history_size(x: str) -> int: return min(ans, 4096 * 1024 * 1024 - 1) +# "single" for backwards compat +url_style_map = {'none': 0, 'single': 1, 'straight': 1, 'double': 2, 'curly': 3, 'dotted': 4, 'dashed': 5} + + def url_style(x: str) -> int: - # for backwards compat - if x == 'single': - x = 'straight' return url_style_map.get(x, url_style_map['curly']) -url_style_map = { - v: i for i, v in enumerate('none straight double curly dotted dashed'.split()) -} - - def url_prefixes(x: str) -> Tuple[str, ...]: return tuple(a.lower() for a in x.replace(',', ' ').split())