@@ -210,16 +210,26 @@ def __init__(
210
210
self .count = count
211
211
self .view = view
212
212
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
213
216
for entry in view .palette :
214
217
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
215
221
background = entry [5 ] if len (entry ) > 4 else entry [2 ]
216
222
inverse_text = background if background else "black"
217
223
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
218
227
view .palette .append (
219
- (self .color , "" , "" , "bold" , f"{ self .color } , bold" , background )
228
+ (f" { self .color } " , "" , "" , "bold" , f"{ self .color } , bold" , background )
220
229
)
230
+ # The s-prefixed style name (eg "s#abc") is used for inverted styling
221
231
view .palette .append (
222
- ("s" + self .color , "" , "" , "standout" , inverse_text , self .color )
232
+ (f"s { self .color } " , "" , "" , "standout" , inverse_text , self .color )
223
233
)
224
234
225
235
stream_marker = STREAM_ACCESS_TYPE [stream_access_type ]["icon" ]
0 commit comments