Skip to content

Commit

Permalink
fix: random theme is applied over custom theme (@fehmer)
Browse files Browse the repository at this point in the history
  • Loading branch information
fehmer committed Sep 19, 2024
1 parent c3b86ec commit 1bf3963
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/ts/controllers/theme-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as Misc from "../utils/misc";
import * as Arrays from "../utils/arrays";
import * as JSONData from "../utils/json-data";
import { isColorDark, isColorLight } from "../utils/colors";
import Config, { setAutoSwitchTheme } from "../config";
import Config, { setAutoSwitchTheme, setCustomTheme } from "../config";
import * as BackgroundFilter from "../elements/custom-background-filter";
import * as ConfigEvent from "../observables/config-event";
import * as DB from "../db";
Expand Down Expand Up @@ -62,6 +62,7 @@ async function updateFavicon(): Promise<void> {
function clearCustomTheme(): void {
console.debug("Theme controller clearing custom theme");
for (const e of colorVars) {
console.log("clear ", e);
document.documentElement.style.setProperty(e, "");
}
}
Expand Down Expand Up @@ -168,6 +169,7 @@ async function apply(

for (let i = 0; i < colorVars.length; i++) {
const colorVar = colorVars[i] as string;
console.log("set ", colorVar);
document.documentElement.style.setProperty(colorVar, colors[i] as string);
}
}
Expand Down Expand Up @@ -302,6 +304,7 @@ export async function randomizeTheme(): Promise<void> {
randomTheme = "custom";
}

setCustomTheme(false, true);
await apply(randomTheme, colorsOverride);

if (randomThemeIndex >= themesList.length) {
Expand Down

0 comments on commit 1bf3963

Please sign in to comment.