Skip to content

Commit 5dbef20

Browse files
committed
Lightened colors.tlBG, added BG key detection to ANSI getters
1 parent 318abc5 commit 5dbef20

16 files changed

Lines changed: 64 additions & 32 deletions

File tree

  • ai-personas/utils/lib
  • computer-languages/utils/lib
  • data-languages/utils/lib
  • find-project-root/src/find_project_root/cli/lib
  • get-min-py/src/get_min_py/cli/lib
  • is-legacy-terminal/src/is_legacy_terminal/cli/lib
  • is-unicode-supported/src/is_unicode_supported/cli/lib
  • latin-locales/utils/lib
  • markup-languages/utils/lib
  • non-latin-locales/utils/lib
  • programming-languages/utils/lib
  • project-markers/utils/lib
  • prose-languages/utils/lib
  • remove-json-keys/src/remove_json_keys/cli/lib
  • sys-lang/src/sys_lang/cli/lib
  • translate-messages/src/translate_messages/cli/lib

ai-personas/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

computer-languages/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

data-languages/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

find-project-root/src/find_project_root/cli/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

get-min-py/src/get_min_py/cli/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

is-legacy-terminal/src/is_legacy_terminal/cli/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

is-unicode-supported/src/is_unicode_supported/cli/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

latin-locales/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

markup-languages/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

non-latin-locales/utils/lib/color.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
nc = '\x1b[0m'
22
hex = {
33
'br': '#ff0000', 'by': '#ffff00', 'bo': '#ffa500', 'bg': '#00ff00',
4-
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#008080'
4+
'bw': '#ffffff', 'dg': '#008000', 'gry': '#808080', 'blk': '#000000', 'tlBG': '#00ffff'
55
}
66

77
def hex_to_ansi(hex_color: str) -> str:
@@ -26,5 +26,7 @@ def rainbow(self) -> list[str]:
2626
schemes = _Schemes()
2727

2828
def __getattr__(hex_key: str) -> str: # add color.hex_key getters that return ANSI
29-
if hex_key in hex: return hex_to_ansi(hex[hex_key])
29+
if hex_key in hex:
30+
ansi = hex_to_ansi(hex[hex_key])
31+
return ansi.replace('[38;', '[48;') if hex_key.endswith('BG') else ansi
3032
raise AttributeError(f"module 'color' has no attribute '{hex_key}'")

0 commit comments

Comments
 (0)