Skip to content

Commit 8caedba

Browse files
committed
fix(cli[_colors]): Handle fg/bg=0 in style() correctly
Change truthiness check from `if fg:` to `if fg or fg == 0:` to handle color index 0 (black) correctly while still treating empty values like () as "no color".
1 parent 6f2cb49 commit 8caedba

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/tmuxp/cli/_colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -722,13 +722,13 @@ def style(
722722

723723
bits = []
724724

725-
if fg:
725+
if fg or fg == 0:
726726
try:
727727
bits.append(f"\033[{_interpret_color(fg)}m")
728728
except (KeyError, ValueError):
729729
raise UnknownStyleColor(color=fg) from None
730730

731-
if bg:
731+
if bg or bg == 0:
732732
try:
733733
bits.append(f"\033[{_interpret_color(bg, 10)}m")
734734
except (KeyError, ValueError):

0 commit comments

Comments
 (0)