Skip to content

Commit cbab00f

Browse files
committed
Updates
1 parent 9af0ff6 commit cbab00f

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎js/initial-background.js‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
// inital check for systems which do not have light or dark mode
22
varnightTabData=JSON.parse(localStorage.getItem("nightTab"));
3-
if(window.matchMedia("(prefers-color-scheme:light)").matches){
4-
if(nightTabData){
5-
if(nightTabData.state.theme.style=="dark"){
6-
document.querySelector("html").setAttribute("style","background-color:rgb(0,0,0)");
3+
if(!document.querySelector("html").classList.contains("is-ready")){
4+
if(window.matchMedia("(prefers-color-scheme:light)").matches){
5+
if(nightTabData){
6+
if(nightTabData.state.theme.style=="dark"){
7+
document.querySelector("html").setAttribute("style","background-color: rgb(0, 0, 0)");
8+
};
79
};
8-
};
9-
}elseif(window.matchMedia("(prefers-color-scheme:dark)").matches){
10-
if(nightTabData){
11-
if(nightTabData.state.theme.style=="light"){
12-
document.querySelector("html").setAttribute("style","background-color:rgb(255,255,255)");
10+
}elseif(window.matchMedia("(prefers-color-scheme:dark)").matches){
11+
if(nightTabData){
12+
if(nightTabData.state.theme.style=="light"){
13+
document.querySelector("html").setAttribute("style","background-color: rgb(255, 255, 255)");
14+
};
1315
};
1416
};
1517
};

0 commit comments

Comments
(0)