Skip to content

Commit 2af8f90

Browse files
committed
apply theme fix
1 parent 3b66e3a commit 2af8f90

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/textual/widgets/_text_area.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -845,11 +845,6 @@ def _set_theme(self, theme: str) -> None:
845845
if background:
846846
self.styles.background = Color.from_rich_color(background)
847847

848-
def apply_theme() -> None:
849-
self._theme.apply_css(self)
850-
851-
self.call_later(apply_theme)
852-
853848
@property
854849
def available_themes(self) -> set[str]:
855850
"""A list of the names of the themes available to the `TextArea`.
@@ -1121,6 +1116,12 @@ def get_line(self, line_index: int) -> Text:
11211116
line_string = self.document.get_line(line_index)
11221117
return Text(line_string, end="", no_wrap=True)
11231118

1119+
def render_lines(self, crop: Region) -> list[Strip]:
1120+
theme = self._theme
1121+
if theme:
1122+
theme.apply_css(self)
1123+
return super().render_lines(crop)
1124+
11241125
def render_line(self, y: int) -> Strip:
11251126
"""Render a single line of the TextArea. Called by Textual.
11261127

0 commit comments

Comments
 (0)