fix key error for themes with randomized primary color

This commit is contained in:
Jenny Danzmayr 2025-01-22 14:53:16 +01:00
parent 639815545c
commit 8c0e258a65

View file

@ -1,3 +1,5 @@
from contextlib import suppress
from c3nav import settings
from c3nav.mapdata.utils.cache.cache_decorator import mapdata_cache
@ -69,6 +71,7 @@ def make_themes(theme_models):
modify_vars(css_vars)
primary_color = css_vars['primary'] if 'primary' in css_vars else base_theme['primary_color']
if theme.randomize_primary_color:
with suppress(KeyError):
del css_vars['primary']
css_vars_str = css_vars_as_str(css_vars)
css_code = (':root{%s}' % css_vars_str)