Skip to content

Commit

Permalink
Fix blinking UI mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ffont committed Nov 2, 2023
1 parent f3eab1b commit b9dc608
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion freesound/context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def context_extra(request):
'next_path': request.GET.get('next', request.get_full_path()),
'login_form': BwFsAuthenticationForm(), # Used for beast whoosh login modal only
'problems_logging_in_form': BwProblemsLoggingInForm(), # Used for beast whoosh login modal only
'system_prefers_dark_theme': request.COOKIES.get('systemPrefersDarkTheme', False) # Determine the user's system preference for dark/light theme (for non authenticated users, always use light theme)
'system_prefers_dark_theme': request.COOKIES.get('systemPrefersDarkTheme', 'no') == 'yes' # Determine the user's system preference for dark/light theme (for non authenticated users, always use light theme)
})

return tvars
10 changes: 5 additions & 5 deletions templates_bw/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
{% elif request.user.profile.ui_theme_preference == 'd' %}
<link id="style" rel="stylesheet" href="{% static 'bw-frontend/dist/index-dark.css' %}" data-forced-theme="yes">
{% else %}
{% if system_prefers_dark_theme %}
<link id="style" rel="stylesheet" href="{% static 'bw-frontend/dist/index-dark.css' %}">
{% else %}
<link id="style" rel="stylesheet" href="{% static 'bw-frontend/dist/index.css' %}">
{% endif %}
{% if system_prefers_dark_theme %}
<link id="style" rel="stylesheet" href="{% static 'bw-frontend/dist/index-dark.css' %}">
{% else %}
<link id="style" rel="stylesheet" href="{% static 'bw-frontend/dist/index.css' %}">
{% endif %}
{% endif %}
</head>
<body>
Expand Down

0 comments on commit b9dc608

Please sign in to comment.