mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 04:50:36 +03:00
This commit is contained in:
parent
00a13495dd
commit
63197273bc
|
@ -22,11 +22,14 @@
|
||||||
<title>Концепт Портал</title>
|
<title>Концепт Портал</title>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
if (
|
let isDark = false;
|
||||||
localStorage.getItem('darkMode') === 'true' ||
|
if ('portal.theme.dark' in localStorage) {
|
||||||
localStorage.getItem('color-theme') === 'dark' ||
|
isDark = localStorage.getItem('portal.theme.dark') === 'true';
|
||||||
(!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)
|
} else if (window.matchMedia) {
|
||||||
) {
|
isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
localStorage.setItem('portal.theme.dark', isDark ? 'true' : 'false');
|
||||||
|
}
|
||||||
|
if (isDark) {
|
||||||
document.documentElement.classList.add('dark');
|
document.documentElement.classList.add('dark');
|
||||||
} else {
|
} else {
|
||||||
document.documentElement.classList.remove('dark');
|
document.documentElement.classList.remove('dark');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user