Skip to content

Commit 96fd45b

Browse files
committed
feat(cli[utils]): Extract CLIColour to type
1 parent f35a26f commit 96fd45b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/tmuxp/cli/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
from .. import log
66

7+
if t.TYPE_CHECKING:
8+
CLIColour: t.TypeAlias = t.Union[int, t.Tuple[int, int, int], str]
9+
10+
711
logger = logging.getLogger(__name__)
812

913

@@ -184,14 +188,14 @@ def _interpret_color(
184188

185189

186190
class UnknownStyleColor(Exception):
187-
def __init__(self, color: str, *args: object, **kwargs: object) -> None:
191+
def __init__(self, color: "CLIColour", *args: object, **kwargs: object) -> None:
188192
return super().__init__(f"Unknown color {color!r}", *args, **kwargs)
189193

190194

191195
def style(
192196
text: t.Any,
193-
fg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None,
194-
bg: t.Optional[t.Union[int, t.Tuple[int, int, int], str]] = None,
197+
fg: t.Optional["CLIColour"] = None,
198+
bg: t.Optional["CLIColour"] = None,
195199
bold: t.Optional[bool] = None,
196200
dim: t.Optional[bool] = None,
197201
underline: t.Optional[bool] = None,

0 commit comments

Comments
 (0)