Skip to content

Commit c94c114

Browse files
chore(Typing): Reworked TTkColor to solve all the typing issues
1 parent e0226db commit c94c114

5 files changed

Lines changed: 332 additions & 288 deletions

File tree

libs/pyTermTk/TermTk/TTkCore/TTkTerm/colors.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# https://conemu.github.io/en/AnsiEscapeCodes.html
2727

2828
import re
29+
from typing import Optional,Tuple
2930

3031
from .colors_ansi_map import ansiMap256, ansiMap16
3132

@@ -61,7 +62,7 @@ class TTkTermColor():
6162
29: ~STRIKETROUGH } # Ps = 2 9 ⇒ Not crossed-out, ECMA-48 3rd.
6263

6364
@staticmethod
64-
def rgb2ansi(fg: tuple=None, bg:tuple=None, mod:int=0, clean:bool=False):
65+
def rgb2ansi(fg: Optional[Tuple[int,int,int]]=None, bg:Optional[Tuple[int,int,int]]=None, mod:int=0, clean:bool=False):
6566
ret = []
6667
ret_append = ret.append
6768

@@ -96,7 +97,7 @@ def rgb2ansi(fg: tuple=None, bg:tuple=None, mod:int=0, clean:bool=False):
9697
return '\033[0m'
9798

9899
@staticmethod
99-
def rgb2ansi_link(fg: tuple=None, bg:tuple=None, mod:int=0, link:str='', clean:bool=False, cleanLink:bool=False):
100+
def rgb2ansi_link(fg: Optional[Tuple[int,int,int]]=None, bg:Optional[Tuple[int,int,int]]=None, mod:int=0, link:str='', clean:bool=False, cleanLink:bool=False):
100101
linkAnsi = ""
101102
if cleanLink:
102103
linkAnsi = "\033]8;;\033\\"

0 commit comments

Comments
 (0)