default theme setting
This commit is contained in:
parent
ce88e5dd3c
commit
4ba2241228
2 changed files with 7 additions and 7 deletions
|
@ -597,6 +597,7 @@ RANDOM_PRIMARY_COLOR_LIST = [hex_from_oklch(PRIMARY_COLOR_RANDOMISATION['lightne
|
|||
PRIMARY_COLOR_RANDOMISATION['chroma'],
|
||||
x) for x in range(0, 360)]
|
||||
|
||||
DEFAULT_THEME = config.getint('c3nav', 'default_theme', fallback=0)
|
||||
BASE_THEME = {
|
||||
'is_dark': config.getboolean('theme', 'is_dark', fallback=False),
|
||||
'randomize_primary_color': config.getboolean('theme', 'randomize_primary_color', fallback=False),
|
||||
|
|
|
@ -42,13 +42,12 @@ def theme(request):
|
|||
themes = css_themes_all()
|
||||
else:
|
||||
themes = css_themes_public()
|
||||
active_theme_id = request.session.get('theme', 0)
|
||||
if active_theme_id in themes:
|
||||
active_theme = themes[active_theme_id]
|
||||
else:
|
||||
active_theme_id = 0
|
||||
active_theme = themes[0]
|
||||
request.session['theme'] = active_theme_id
|
||||
default_theme_id = settings.DEFAULT_THEME if settings.DEFAULT_THEME in themes else 0
|
||||
active_theme_id = request.session.get('theme', default_theme_id)
|
||||
if active_theme_id not in themes:
|
||||
active_theme_id = default_theme_id
|
||||
|
||||
active_theme = themes[active_theme_id]
|
||||
|
||||
if active_theme['randomize_primary_color']:
|
||||
from c3nav.site.themes import get_random_primary_color
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue