Skip to content

Commit

Permalink
Finish merge
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Oct 21, 2024
1 parent 2f97fbf commit 51cf2e9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,11 +493,11 @@ class MyApp(App[None]):
INLINE_PADDING: ClassVar[int] = 1
"""Number of blank lines above an inline app."""

_PSEUDO_CLASSES: ClassVar[dict[str, Callable[[App], bool]]] = {
_PSEUDO_CLASSES: ClassVar[dict[str, Callable[[App[Any]], bool]]] = {
"focus": lambda app: app.app_focus,
"blur": lambda app: not app.app_focus,
"dark": lambda app: app.dark,
"light": lambda app: not app.dark,
"dark": lambda app: app.current_theme.dark,
"light": lambda app: not app.current_theme.dark,
"inline": lambda app: app.is_inline,
"ansi": lambda app: app.ansi_color,
"nocolor": lambda app: app.no_color,
Expand Down Expand Up @@ -1227,6 +1227,12 @@ def available_themes(self) -> dict[str, Theme]:
"""
return {**BUILTIN_THEMES, **self._registered_themes}

@property
def current_theme(self) -> Theme:
theme = self.get_theme(self.theme)
assert theme is not None # validated by _validate_theme
return theme

def _validate_theme(self, theme_name: str) -> str:
if theme_name not in self.available_themes:
message = (
Expand Down

0 comments on commit 51cf2e9

Please sign in to comment.