improve performance even more of that function

This commit is contained in:
MathMan05 2024-07-31 23:24:37 -05:00
parent ac4094394c
commit 983b7e3fa2
2 changed files with 77 additions and 75 deletions

View file

@ -910,11 +910,13 @@ Channel.setupcontextmenu();
export { Channel }; export { Channel };
{ {
let last; let last;
const dud = document.createElement("p");
dud.classList.add("svgtheme");
document.body.append(dud);
const css = window.getComputedStyle(dud);
function fixsvgtheme() { function fixsvgtheme() {
const things = document.getElementsByClassName("svgtheme");
//console.log(things); //console.log(things);
if (things.length) { const thing = css.color.replace("rgb(", "").replace(")", "").split(",");
const thing = window.getComputedStyle(things[0]).color.replace("rgb(", "").replace(")", "").split(",");
//sconsole.log(thing); //sconsole.log(thing);
const r = +thing[0] / 255; const r = +thing[0] / 255;
const g = +thing[1] / 255; const g = +thing[1] / 255;
@ -956,6 +958,5 @@ export { Channel };
document.documentElement.style.setProperty('--brightness', brightness); document.documentElement.style.setProperty('--brightness', brightness);
} }
} }
}
setInterval(fixsvgtheme, 100); setInterval(fixsvgtheme, 100);
} }

View file

@ -901,11 +901,13 @@ Channel.setupcontextmenu();
export {Channel}; export {Channel};
{ {
let last:string; let last:string;
const dud=document.createElement("p")
dud.classList.add("svgtheme")
document.body.append(dud);
const css=window.getComputedStyle(dud);
function fixsvgtheme(){ function fixsvgtheme(){
const things=document.getElementsByClassName("svgtheme");
//console.log(things); //console.log(things);
if(things.length){ const thing=css.color.replace("rgb(","").replace(")","").split(",");
const thing=window.getComputedStyle(things[0]).color.replace("rgb(","").replace(")","").split(",");
//sconsole.log(thing); //sconsole.log(thing);
const r=+thing[0]/255; const r=+thing[0]/255;
const g=+thing[1]/255; const g=+thing[1]/255;
@ -944,6 +946,5 @@ export {Channel};
document.documentElement.style.setProperty('--brightness', brightness); document.documentElement.style.setProperty('--brightness', brightness);
} }
} }
}
setInterval(fixsvgtheme,100); setInterval(fixsvgtheme,100);
} }