This commit is contained in:
parent
a60c1fef23
commit
10b5ce30a3
1 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,12 @@
|
||||||
function themeToggle() {
|
function themeToggle() {
|
||||||
const oldValue = localStorage.getItem('theme');
|
let oldValue = localStorage.getItem('theme');
|
||||||
|
if (!oldValue) {
|
||||||
|
oldValue = 'light';
|
||||||
|
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||||
|
oldValue = 'dark';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let newValue;
|
let newValue;
|
||||||
if (oldValue == 'light') {
|
if (oldValue == 'light') {
|
||||||
newValue = 'dark';
|
newValue = 'dark';
|
||||||
|
|
Loading…
Add table
Reference in a new issue