@@ -210,16 +210,26 @@ def __init__(
210210 self .count = count
211211 self .view = view
212212
213+ # FIXME: This section should be moved to a general palette-extension method
214+ # which is triggered when streams are initially loaded and when colors are
215+ # adjusted, or new streams added
213216 for entry in view .palette :
214217 if entry [0 ] is None :
218+ # NOTE: entry is generated at runtime, so length is dynamic
219+ # entry[5] is 256-color background entry
220+ # entry[2] is 16-color background entry
215221 background = entry [5 ] if len (entry ) > 4 else entry [2 ]
216222 inverse_text = background if background else "black"
217223 break
224+ # These tuples represent (new) Urwid palette entries for the stream color:
225+ # (style_name, 16-color fg, 16-color bg, mono, 256+color fg, 256+color bg)
226+ # The normalized color becomes a named style (eg. "#abc") for colored foreground
218227 view .palette .append (
219- (self .color , "" , "" , "bold" , f"{ self .color } , bold" , background )
228+ (f" { self .color } " , "" , "" , "bold" , f"{ self .color } , bold" , background )
220229 )
230+ # The s-prefixed style name (eg "s#abc") is used for inverted styling
221231 view .palette .append (
222- ("s" + self .color , "" , "" , "standout" , inverse_text , self .color )
232+ (f"s { self .color } " , "" , "" , "standout" , inverse_text , self .color )
223233 )
224234
225235 stream_marker = STREAM_ACCESS_TYPE [stream_access_type ]["icon" ]
0 commit comments