Skip to content

Commit

Permalink
Fix snapshot, record theme_variables on App
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Nov 14, 2024
1 parent 6902c1a commit d942e52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 158 deletions.
8 changes: 7 additions & 1 deletion src/textual/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,9 @@ def __init__(
self._css_update_count: int = 0
"""Incremented when CSS is invalidated."""

self.theme_variables: dict[str, str] = {}
"""Variables generated from the current theme."""

if self.ENABLE_COMMAND_PALETTE:
for _key, binding in self._bindings:
if binding.action in {"command_palette", "app.command_palette"}:
Expand Down Expand Up @@ -1180,7 +1183,10 @@ def get_css_variables(self) -> dict[str, str]:
# Apply the additional variables from the theme
variables = {**variables, **(theme.variables)}
theme_variables = self.get_theme_variable_defaults()
return {**theme_variables, **variables}

combined_variables = {**theme_variables, **variables}
self.theme_variables = combined_variables
return combined_variables

def get_theme(self, theme_name: str) -> Theme | None:
"""Get a theme by name.
Expand Down

This file was deleted.

0 comments on commit d942e52

Please sign in to comment.