also dim svg images
This commit is contained in:
parent
2e031e127d
commit
47688337dd
1 changed files with 10 additions and 2 deletions
|
@ -54,13 +54,21 @@ const svgChangeTheme = (mode) => {
|
||||||
|
|
||||||
const treshold = 128;
|
const treshold = 128;
|
||||||
|
|
||||||
|
const style = "filter: ";
|
||||||
|
const dim = "brightness(0.8) contrast(1.2)";
|
||||||
|
|
||||||
if (averageGrayscale < treshold && mode === Mode.Dark) {
|
if (averageGrayscale < treshold && mode === Mode.Dark) {
|
||||||
item.style = "filter: invert(1);";
|
item.style = style + dim + " invert(1);";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (averageGrayscale > treshold && mode === Mode.Light) {
|
if (averageGrayscale > treshold && mode === Mode.Light) {
|
||||||
item.style = "filter: invert(1);";
|
item.style = style + "invert(1);";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode === Mode.Dark) {
|
||||||
|
item.style = style + `${dim};`;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue