Add color theme customization support

This commit is contained in:
Kiril Kovachev 2024-10-14 17:10:12 +01:00
parent 5d6ededd57
commit 152a9bc950
4 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,3 @@
body {
background: green;
}

View File

@ -0,0 +1,3 @@
body {
background-color: white;
}

View File

@ -0,0 +1,3 @@
@import url("/static/light_theme.css") (prefers-color-scheme: light);
@import url("/static/dark_theme.css") (prefers-color-scheme: no-preference);
@import url("/static/dark_theme.css") (prefers-color-scheme: dark);

View File

@ -4,6 +4,11 @@
<head>
<title>{% block title %}{% endblock %} - {{ localize("kanken_online") }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
{% if session %}
<link rel="stylesheet" href="{{ url_for('static', filename='dark_theme.css') if session['theme'] == 'dark' else url_for('static', filename='light_theme.css')}}">
{% else %}
<link rel="stylesheet" href="{{ url_for('static', filename='theme_select.css') }}"> <!-- Use CSS-based theme detection if no user login supplied -->
{% endif %}
{% block styles %}{% endblock %}
{% block scripts %}{% endblock %}
</head>