Skip to content

Commit fe5fe7a

Browse files
committed
fix(border): fix flipped title colors in panel border
Revert the change to the color flipping logic for `panel` border titles. The issue with the new method using `Style(reverse=True)` is that this will also flip any border title colors set with Textual CSS. Fixes #5548.
1 parent 4ec7d38 commit fe5fe7a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/textual/_border.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,10 @@ def render_border_label(
385385
assert False
386386

387387
if (flip_top and is_title) or (flip_bottom and not is_title):
388-
base_style = base_style.without_color + Style(reverse=True)
388+
base_style = base_style.without_color + Style(
389+
background=base_style.foreground,
390+
foreground=base_style.background,
391+
)
389392

390393
segments = text_label.render_segments(base_style)
391394
yield from segments

src/textual/_styles_cache.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,11 @@ def post(segments: Iterable[Segment]) -> Iterable[Segment]:
379379
if label_background.a
380380
else TRANSPARENT
381381
),
382-
(base_label_background + border_color + label_color),
382+
(
383+
(base_label_background + label_color)
384+
if label_color.a
385+
else TRANSPARENT
386+
),
383387
)
384388
render_label = (label, style)
385389

0 commit comments

Comments
 (0)