Skip to content

Commit

Permalink
Color Schemes: Inherit base scheme color entries
Browse files Browse the repository at this point in the history
  • Loading branch information
mborgerson committed Feb 6, 2025
1 parent ae3fd60 commit 6d13a0c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions angrmanagement/config/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from angrmanagement.utils.env import app_root

from .color_schemes import COLOR_SCHEMES
from .color_schemes import BASE_SCHEME, COLOR_SCHEMES
from .config_entry import ConfigurationEntry as CE

if TYPE_CHECKING:
Expand Down Expand Up @@ -690,7 +690,11 @@ def load_default_theme_entries(theme_name: str, entries: dict[str, Any]) -> None
if not COLOR_SCHEMES or theme_name not in COLOR_SCHEMES:
return

theme = COLOR_SCHEMES[theme_name]
theme = (
COLOR_SCHEMES[theme_name]
if theme_name == BASE_SCHEME
else {**COLOR_SCHEMES[BASE_SCHEME], **COLOR_SCHEMES[theme_name]}
)
for k, v in theme.items():
entries[k] = CE(k, type(v), v)

Expand Down
6 changes: 4 additions & 2 deletions angrmanagement/ui/dialogs/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)

from angrmanagement.config import Conf, save_config
from angrmanagement.config.color_schemes import COLOR_SCHEMES
from angrmanagement.config.color_schemes import BASE_SCHEME, COLOR_SCHEMES
from angrmanagement.config.config_manager import ENTRIES
from angrmanagement.logic.url_scheme import AngrUrlScheme
from angrmanagement.ui.css import refresh_theme
Expand Down Expand Up @@ -186,7 +186,9 @@ def _init_widgets(self) -> None:
def _load_color_scheme(self, name: str) -> None:
if name not in COLOR_SCHEMES:
return
for prop, value in COLOR_SCHEMES[name].items():

scheme = COLOR_SCHEMES[name] if name == BASE_SCHEME else {**COLOR_SCHEMES[BASE_SCHEME], **COLOR_SCHEMES[name]}
for prop, value in scheme.items():
if prop in self._colors_to_save:
row = self._colors_to_save[prop][1]
row.set_color(value)
Expand Down

0 comments on commit 6d13a0c

Please sign in to comment.