theme settings fixes
This commit is contained in:
parent
03426c1989
commit
679dc72e21
3 changed files with 13 additions and 15 deletions
|
@ -418,7 +418,7 @@ def create_editor_form(editor_model):
|
||||||
'label_settings', 'label_override', 'min_zoom', 'max_zoom', 'font_size',
|
'label_settings', 'label_override', 'min_zoom', 'max_zoom', 'font_size',
|
||||||
'allow_levels', 'allow_spaces', 'allow_areas', 'allow_pois', 'allow_dynamic_locations',
|
'allow_levels', 'allow_spaces', 'allow_areas', 'allow_pois', 'allow_dynamic_locations',
|
||||||
'left', 'top', 'right', 'bottom', 'import_tag', 'import_block_data', 'import_block_geom',
|
'left', 'top', 'right', 'bottom', 'import_tag', 'import_block_data', 'import_block_geom',
|
||||||
'public', 'high_contrast', 'funky', 'randomize_primary_color', 'color_logo',
|
'public', 'default', 'dark', 'high_contrast', 'funky', 'randomize_primary_color', 'color_logo',
|
||||||
'color_css_initial', 'color_css_primary', 'color_css_secondary', 'color_css_tertiary',
|
'color_css_initial', 'color_css_primary', 'color_css_secondary', 'color_css_tertiary',
|
||||||
'color_css_quaternary', 'color_css_quinary', 'color_css_header_background',
|
'color_css_quaternary', 'color_css_quinary', 'color_css_header_background',
|
||||||
'color_css_header_text', 'color_css_header_text_hover',
|
'color_css_header_text', 'color_css_header_text_hover',
|
||||||
|
|
|
@ -560,8 +560,8 @@ RANDOM_PRIMARY_COLOR_LIST = [hex_from_oklch(PRIMARY_COLOR_RANDOMISATION['lightne
|
||||||
x) for x in range(0, 360)]
|
x) for x in range(0, 360)]
|
||||||
|
|
||||||
BASE_THEME = {
|
BASE_THEME = {
|
||||||
'is_dark': config.get('theme', 'is_dark', fallback=False),
|
'is_dark': config.getboolean('theme', 'is_dark', fallback=False),
|
||||||
'randomize_primary_color': config.get('theme', 'randomize_primary_color', fallback=False),
|
'randomize_primary_color': config.getboolean('theme', 'randomize_primary_color', fallback=False),
|
||||||
'map': {
|
'map': {
|
||||||
'background': config.get('theme', 'map_background', fallback='#dcdcdc'),
|
'background': config.get('theme', 'map_background', fallback='#dcdcdc'),
|
||||||
'wall_fill': config.get('theme', 'map_wall_fill', fallback='#aaaaaa'),
|
'wall_fill': config.get('theme', 'map_wall_fill', fallback='#aaaaaa'),
|
||||||
|
|
|
@ -81,18 +81,16 @@ def make_themes(theme_models):
|
||||||
'primary_color': primary_color,
|
'primary_color': primary_color,
|
||||||
}
|
}
|
||||||
if theme.default:
|
if theme.default:
|
||||||
|
default_theme = {
|
||||||
|
'css_code': css_code,
|
||||||
|
'theme_color': css_vars['header-background'],
|
||||||
|
'randomize_primary_color': theme.randomize_primary_color,
|
||||||
|
'primary_color': primary_color,
|
||||||
|
}
|
||||||
if theme.dark:
|
if theme.dark:
|
||||||
default_dark = {
|
default_dark = default_theme
|
||||||
'css_code': css_code,
|
|
||||||
'theme_color': css_vars['header-background'],
|
|
||||||
'primary_color': primary_color,
|
|
||||||
}
|
|
||||||
else:
|
else:
|
||||||
default_light = {
|
default_light = default_theme
|
||||||
'css_code': css_code,
|
|
||||||
'theme_color': css_vars['header-background'],
|
|
||||||
'primary_color': primary_color,
|
|
||||||
}
|
|
||||||
|
|
||||||
if default_dark is not None and default_light is not None:
|
if default_dark is not None and default_light is not None:
|
||||||
name = _('Automatic')
|
name = _('Automatic')
|
||||||
|
@ -118,13 +116,13 @@ def make_themes(theme_models):
|
||||||
return themes
|
return themes
|
||||||
|
|
||||||
|
|
||||||
@mapdata_cache
|
# @mapdata_cache
|
||||||
def css_themes_all():
|
def css_themes_all():
|
||||||
from c3nav.mapdata.models.theme import Theme
|
from c3nav.mapdata.models.theme import Theme
|
||||||
return make_themes(Theme.objects.all())
|
return make_themes(Theme.objects.all())
|
||||||
|
|
||||||
|
|
||||||
@mapdata_cache
|
# @mapdata_cache
|
||||||
def css_themes_public():
|
def css_themes_public():
|
||||||
from c3nav.mapdata.models.theme import Theme
|
from c3nav.mapdata.models.theme import Theme
|
||||||
return make_themes(Theme.objects.filter(public=True))
|
return make_themes(Theme.objects.filter(public=True))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue