From b9dc6086dd84b543f752ec8748657b565a525f89 Mon Sep 17 00:00:00 2001 From: ffont Date: Thu, 2 Nov 2023 10:31:43 +0100 Subject: [PATCH] Fix blinking UI mode --- freesound/context_processor.py | 2 +- templates_bw/base.html | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/freesound/context_processor.py b/freesound/context_processor.py index e083b6350..c921304c4 100644 --- a/freesound/context_processor.py +++ b/freesound/context_processor.py @@ -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 diff --git a/templates_bw/base.html b/templates_bw/base.html index 95f74508d..0dc2777e5 100644 --- a/templates_bw/base.html +++ b/templates_bw/base.html @@ -17,11 +17,11 @@ {% elif request.user.profile.ui_theme_preference == 'd' %} {% else %} - {% if system_prefers_dark_theme %} - - {% else %} - - {% endif %} + {% if system_prefers_dark_theme %} + + {% else %} + + {% endif %} {% endif %}