Skip to content

Commit d264fce

Browse files
authored
fix(theme): problems with theme preview (@fehmer) (monkeytypegame#6881)
1. when a custom theme is active preview of regular theme was not applied, introduced with monkeytypegame@fdead53 2. when custom theme is active previewing other custom themes set the color to the active custom theme first, then the selected one causing flashing To reproduce: 1. preview of regular theme not working - create a custom theme with black background, activate it - open commandline to preview a regular theme 2. custom theme colors get set multiple times - create a custom theme with white background called white and activate it - create to custom themes with black background called black1 and black2 - switch preview between black1 and black2
1 parent 44ceb71 commit d264fce

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

frontend/src/ts/commandline/commandline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ async function updateActiveCommand(): Promise<void> {
556556
activeCommand = command ?? null;
557557
if (element === undefined || command === undefined) {
558558
clearFontPreview();
559-
void ThemeController.clearPreview();
559+
void ThemeController.clearPreview(false);
560560
addCommandlineBackground();
561561
return;
562562
}
@@ -567,7 +567,7 @@ async function updateActiveCommand(): Promise<void> {
567567
if (/changeTheme.+/gi.test(command.id)) {
568568
removeCommandlineBackground();
569569
} else {
570-
void ThemeController.clearPreview();
570+
void ThemeController.clearPreview(false);
571571
addCommandlineBackground();
572572
}
573573

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ async function apply(
154154
customColorsOverride,
155155
isPreview
156156
);
157-
if (!Config.customTheme) {
157+
158+
if (themeName !== "custom") {
158159
clearCustomTheme();
159160
}
160161
const name = customColorsOverride ? "custom" : themeName;

0 commit comments

Comments
 (0)