Skip to content
Snippets Groups Projects
Commit 37c2547e authored by Julian's avatar Julian
Browse files

Implement dark theme

parent 662b46a4
No related branches found
No related tags found
2 merge requests!1046Draft: Resolve "[3.0] Meta-issue for GraphQL back-end and Vue.js frontend",!1045Introduce Vuetify and GraphQL
Pipeline #72704 failed
......@@ -198,6 +198,21 @@ class NotificationChannels(ChoicePreference):
choices = get_notification_choices_lazy()
@person_preferences_registry.register
class Design(ChoicePreference):
"""Change design (on supported pages)."""
section = theme
name = "design"
default = "system"
verbose_name = _("Select Design")
choices = [
("system", _("System Design")),
("light", _("Light mode")),
("dark", _("Dark mode")),
]
@site_preferences_registry.register
class PrimaryGroupPattern(StringPreference):
"""Regular expression to match primary group."""
......
......@@ -7,11 +7,16 @@ const vuetify = new Vuetify({
iconfont: 'mdi', // default - only for display purposes
},
theme: {
dark: JSON.parse(document.getElementById("design-mode").textContent) === "dark",
themes: {
light: {
primary: JSON.parse(document.getElementById("primary-color").textContent),
secondary: JSON.parse(document.getElementById("secondary-color").textContent),
},
dark: {
primary: JSON.parse(document.getElementById("primary-color").textContent),
secondary: JSON.parse(document.getElementById("secondary-color").textContent),
},
},
},
})
......
......@@ -215,6 +215,7 @@
{% include_js "jquery-sortablejs" %}
{{ request.site.preferences.theme__primary|json_script:"primary-color" }}
{{ request.site.preferences.theme__secondary|json_script:"secondary-color" }}
{{ request.user.person.preferences.theme__design|json_script:"design-mode" }}
{#{{ request.site.preferences.all|json_script:"preferences" }}#}
<script type="text/javascript" src="{% static 'js/search.js' %}"></script>
<script type="text/javascript" src="{% static 'js/vue/main_vue.js' %}"></script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment