Skip to content

Commit 4dc485f

Browse files
committed
fix dim
1 parent 6dbad4a commit 4dc485f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/textual/filter.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,17 +248,18 @@ def truecolor_style(self, style: Style, background: RichColor) -> Style:
248248
color.get_truecolor(terminal_theme, foreground=True)
249249
)
250250
changed = True
251-
if style.dim:
252-
color = dim_color(background, color)
253-
style += NO_DIM
254-
changed = True
255251

256252
if (bgcolor := style.bgcolor) is not None and bgcolor.triplet is None:
257253
bgcolor = RichColor.from_triplet(
258254
bgcolor.get_truecolor(terminal_theme, foreground=False)
259255
)
260256
changed = True
261257

258+
if style.dim and color is not None:
259+
color = dim_color(background if bgcolor is None else bgcolor, color)
260+
style += NO_DIM
261+
changed = True
262+
262263
return style + Style.from_color(color, bgcolor) if changed else style
263264

264265
def apply(self, segments: list[Segment], background: Color) -> list[Segment]:

0 commit comments

Comments
 (0)