various fixes
This commit is contained in:
parent
2d9d71c91f
commit
678bb73e1e
7 changed files with 160 additions and 108 deletions
|
@ -184,9 +184,14 @@ class Channel {
|
|||
ids[id] = res;
|
||||
return html;
|
||||
}.bind(this), async function (id) {
|
||||
ids[id]();
|
||||
delete ids[id];
|
||||
return true;
|
||||
if (ids[id]) {
|
||||
ids[id]();
|
||||
delete ids[id];
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}.bind(this), this.readbottom.bind(this));
|
||||
}
|
||||
constructor(json, owner) {
|
||||
|
@ -1038,55 +1043,3 @@ class Channel {
|
|||
}
|
||||
Channel.setupcontextmenu();
|
||||
export { Channel };
|
||||
{
|
||||
let last;
|
||||
const dud = document.createElement("p");
|
||||
dud.classList.add("svgtheme");
|
||||
document.body.append(dud);
|
||||
const css = window.getComputedStyle(dud);
|
||||
function fixsvgtheme() {
|
||||
//console.log(things);
|
||||
const thing = css.color.replace("rgb(", "").replace(")", "").split(",");
|
||||
//sconsole.log(thing);
|
||||
const r = +thing[0] / 255;
|
||||
const g = +thing[1] / 255;
|
||||
const b = +thing[2] / 255;
|
||||
const max = Math.max(r, g, b);
|
||||
const min = Math.min(r, g, b);
|
||||
const l = (max + min) / 2;
|
||||
let s;
|
||||
let h;
|
||||
if (max !== min) {
|
||||
if (l <= .5) {
|
||||
s = (max - min) / (max + min);
|
||||
}
|
||||
else {
|
||||
s = (max - min) / (2.0 - max - min);
|
||||
}
|
||||
if (r === max) {
|
||||
h = (g - b) / (max - min);
|
||||
}
|
||||
else if (g === max) {
|
||||
h = 2 + (b - r) / (max - min);
|
||||
}
|
||||
else if (b === max) {
|
||||
h = 4 + (r - g) / (max - min);
|
||||
}
|
||||
}
|
||||
else {
|
||||
s = 0;
|
||||
h = 0;
|
||||
}
|
||||
const rot = Math.floor(h * 60) + "deg";
|
||||
const invert = .5 - (s / 2) + "";
|
||||
const brightness = Math.floor((l * 200)) + "%";
|
||||
const current = rot + invert + brightness;
|
||||
if (current !== last) {
|
||||
last = current;
|
||||
document.documentElement.style.setProperty('--rot', rot);
|
||||
document.documentElement.style.setProperty('--invert', invert);
|
||||
document.documentElement.style.setProperty('--brightness', brightness);
|
||||
}
|
||||
}
|
||||
setInterval(fixsvgtheme, 100);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue