From 467f80faee61bdc1f1b8ad0cfee44e0892b114f9 Mon Sep 17 00:00:00 2001 From: Jose Palazon Date: Mon, 9 Sep 2024 17:58:15 +0100 Subject: [PATCH] html dark mode --- flaskr/static/style.css | 4 ++++ flaskr/templates/base.html | 1 + 2 files changed, 5 insertions(+) diff --git a/flaskr/static/style.css b/flaskr/static/style.css index 46187073..0b22aba7 100644 --- a/flaskr/static/style.css +++ b/flaskr/static/style.css @@ -186,6 +186,10 @@ input[type=submit]:hover { color: #333; } +html.dark-mode { + background: #555555; +} + body.dark-mode #theme-toggle { background: #4d4d4d; } diff --git a/flaskr/templates/base.html b/flaskr/templates/base.html index 9f0bd1cd..e2b2c64a 100644 --- a/flaskr/templates/base.html +++ b/flaskr/templates/base.html @@ -35,6 +35,7 @@ const currentTheme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); if (currentTheme === 'dark') { + document.body.parentElement.classList.add('dark-mode'); document.body.classList.add('dark-mode'); // themeIcon.classList.remove('fa-moon'); // themeIcon.classList.add('fa-sun');