mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
22 lines
507 B
JavaScript
22 lines
507 B
JavaScript
|
const globalDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||
|
const localMode = localStorage.getItem('theme');
|
||
|
|
||
|
if (globalDark && (localMode === null)) {
|
||
|
|
||
|
localStorage.setItem('theme', 'dark');
|
||
|
document.documentElement.setAttribute('data-dark-mode', '');
|
||
|
|
||
|
}
|
||
|
|
||
|
if (globalDark && (localMode === 'dark')) {
|
||
|
|
||
|
document.documentElement.setAttribute('data-dark-mode', '');
|
||
|
|
||
|
}
|
||
|
|
||
|
if (localMode === 'dark') {
|
||
|
|
||
|
document.documentElement.setAttribute('data-dark-mode', '');
|
||
|
|
||
|
}
|