bug(ui) fix flicker refreshing background color (#19041)

This commit is contained in:
Jacob Richman
2026-02-13 15:33:02 -08:00
committed by GitHub
parent d782cfe984
commit d3e74530b8
6 changed files with 55 additions and 29 deletions
+14 -2
View File
@@ -56,11 +56,18 @@ export function useTerminalTheme(
if (!match) return;
const hexColor = parseColor(match[1], match[2], match[3]);
const luminance = getLuminance(hexColor);
if (!hexColor) return;
const previousColor = config.getTerminalBackground();
if (previousColor === hexColor) {
return;
}
config.setTerminalBackground(hexColor);
themeManager.setTerminalBackground(hexColor);
refreshStatic();
const luminance = getLuminance(hexColor);
const currentThemeName = settings.merged.ui.theme;
const newTheme = shouldSwitchTheme(
@@ -72,6 +79,11 @@ export function useTerminalTheme(
if (newTheme) {
void handleThemeSelect(newTheme, SettingScope.User);
} else {
// The existing theme had its background changed so refresh because
// there may be existing static UI rendered that relies on the old
// background color.
refreshStatic();
}
};