Skip to content

Commit 634f791

Browse files
authored
fix(theme-controller): flashing issue when switching between custom & preset (@byseif21) (monkeytypegame#6943)
Closes monkeytypegame#6939
1 parent ed9aa87 commit 634f791

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

frontend/src/ts/controllers/theme-controller.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,8 @@ async function apply(
155155
isPreview
156156
);
157157

158-
if (themeName !== "custom") {
159-
clearCustomTheme();
160-
}
161158
const name = customColorsOverride ? "custom" : themeName;
162159

163-
ThemeColors.reset();
164-
165-
$(".keymapKey").attr("style", "");
166-
// $("#currentTheme").attr("href", `themes/${name}.css`);
167-
await loadStyle(name);
168-
ThemeColors.update();
169-
170160
if ((Config.customTheme && !isPreview) || customColorsOverride) {
171161
const colors = customColorsOverride ?? Config.customThemeColors;
172162

@@ -176,6 +166,18 @@ async function apply(
176166
}
177167
}
178168

169+
ThemeColors.reset();
170+
171+
$(".keymapKey").attr("style", "");
172+
// $("#currentTheme").attr("href", `themes/${name}.css`);
173+
await loadStyle(name);
174+
175+
if (name !== "custom") {
176+
clearCustomTheme();
177+
}
178+
179+
ThemeColors.update();
180+
179181
// if (!isPreview) {
180182
const colors = await ThemeColors.getAll();
181183
$(".keymapKey").attr("style", "");

0 commit comments

Comments
 (0)