diff --git a/pflaenzli/pflaenzli/static/bootstrap-color-toggler.js b/pflaenzli/pflaenzli/static/bootstrap-color-toggler.js index 9915265..897efc7 100644 --- a/pflaenzli/pflaenzli/static/bootstrap-color-toggler.js +++ b/pflaenzli/pflaenzli/static/bootstrap-color-toggler.js @@ -20,8 +20,10 @@ const setTheme = function(theme) { if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) { document.documentElement.setAttribute('data-bs-theme', 'dark') + set_captcha_theme('dark', 0) } else { document.documentElement.setAttribute('data-bs-theme', theme) + set_captcha_theme(theme, 0) } } @@ -59,4 +61,17 @@ }) }) }) -})() \ No newline at end of file +})() + +function set_captcha_theme(theme, set_try) { + var captchaDiv = document.getElementById("id_captcha"); + + if (captchaDiv) { + console.log("Set the theme on try" + set_try) + if (theme == 'dark') { + captchaDiv.classList.add("dark"); + } else { + captchaDiv.classList.remove("dark"); + } + } +}; \ No newline at end of file diff --git a/pflaenzli/pflaenzli/templates/base.html b/pflaenzli/pflaenzli/templates/base.html index cf44b72..60ca085 100644 --- a/pflaenzli/pflaenzli/templates/base.html +++ b/pflaenzli/pflaenzli/templates/base.html @@ -46,7 +46,6 @@ - {% block head %}{% endblock %} @@ -93,7 +92,7 @@ {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %}
  • -
    + {% csrf_token %}