Skip to content

Commit fa282cd

Browse files
committed
buttons: Ensure foreground on stream background is never transparent.
Previously the foreground color on a stream-color background was the general theme background color, or "black" if that general background color was Falsey - typically the empty string: "". The empty string is one value to indicate the terminal default color in urwid - the background in this case - and so enable a transparent background in some terminal emulators. This logic therefore ensured that the text color on a colored background was not itself transparent, and enabled the previous implementation of background transparency. However, it is clearer if the alternative explicit string of "default" is used for this purpose, since this is a finite recognizable string that can be structured in the same way as other multi-color-depth colors are now specified - as a sequence of color words. This has not been an issue ever since transparency support was removed and the theme system dramatically updated, but is necessary to add back support for background transparency. This commit therefore extends the transparent detection for such cases to include "default", without which use of "default" elsewhere would lead to transparent foreground characters.
1 parent 070cf2b commit fa282cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

zulipterminal/ui_tools/buttons.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def __init__(
219219
# entry[5] is 256-color background entry
220220
# entry[2] is 16-color background entry
221221
background = entry[5] if len(entry) > 4 else entry[2]
222-
inverse_text = background if background else "black"
222+
inverse_text = "black" if background in ["default", ""] else background
223223
break
224224
# These tuples represent (new) Urwid palette entries for the stream color:
225225
# (style_name, 16-color fg, 16-color bg, mono, 256+color fg, 256+color bg)

0 commit comments

Comments
 (0)