html dark mode

This commit is contained in:
Jose Palazon 2024-09-09 17:58:15 +01:00
parent 9fa696d5a9
commit 467f80faee
2 changed files with 5 additions and 0 deletions

View file

@ -186,6 +186,10 @@ input[type=submit]:hover {
color: #333; color: #333;
} }
html.dark-mode {
background: #555555;
}
body.dark-mode #theme-toggle { body.dark-mode #theme-toggle {
background: #4d4d4d; background: #4d4d4d;
} }

View file

@ -35,6 +35,7 @@
const currentTheme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'); const currentTheme = localStorage.getItem('theme') || (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
if (currentTheme === 'dark') { if (currentTheme === 'dark') {
document.body.parentElement.classList.add('dark-mode');
document.body.classList.add('dark-mode'); document.body.classList.add('dark-mode');
// themeIcon.classList.remove('fa-moon'); // themeIcon.classList.remove('fa-moon');
// themeIcon.classList.add('fa-sun'); // themeIcon.classList.add('fa-sun');