html dark mode
This commit is contained in:
parent
9fa696d5a9
commit
467f80faee
2 changed files with 5 additions and 0 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue