From c0cb2b9412404eeff036865dfc70fa7aa1b50064 Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 14 Jan 2026 11:28:18 +0100 Subject: [PATCH] add debug statements to ThemeMainService (#287735) --- .../electron-main/themeMainServiceImpl.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/vs/platform/theme/electron-main/themeMainServiceImpl.ts b/src/vs/platform/theme/electron-main/themeMainServiceImpl.ts index 8a31973e9d1..57f6c794e17 100644 --- a/src/vs/platform/theme/electron-main/themeMainServiceImpl.ts +++ b/src/vs/platform/theme/electron-main/themeMainServiceImpl.ts @@ -15,7 +15,7 @@ import { ThemeTypeSelector } from '../common/theme.js'; import { ISingleFolderWorkspaceIdentifier, IWorkspaceIdentifier } from '../../workspace/common/workspace.js'; import { coalesce } from '../../../base/common/arrays.js'; import { getAllWindowsExcludingOffscreen } from '../../windows/electron-main/windows.js'; -import { ILogService } from '../../log/common/log.js'; +import { ILogService, LogLevel } from '../../log/common/log.js'; import { IThemeMainService } from './themeMainService.js'; // These default colors match our default themes @@ -82,9 +82,23 @@ export class ThemeMainService extends Disposable implements IThemeMainService { })); } this.updateSystemColorTheme(); + this.logThemeSettings(); // Color Scheme changes - this._register(Event.fromNodeEventEmitter(electron.nativeTheme, 'updated')(() => this._onDidChangeColorScheme.fire(this.getColorScheme()))); + this._register(Event.fromNodeEventEmitter(electron.nativeTheme, 'updated')(() => { + this.logThemeSettings(); + this._onDidChangeColorScheme.fire(this.getColorScheme()); + })); + } + private logThemeSettings(): void { + if (this.logService.getLevel() >= LogLevel.Debug) { + const logSetting = (setting: string) => `${setting}=${this.configurationService.getValue(setting)}`; + this.logService.debug(`[theme main service] ${logSetting(ThemeSettings.DETECT_COLOR_SCHEME)}, ${logSetting(ThemeSettings.DETECT_HC)}, ${logSetting(ThemeSettings.SYSTEM_COLOR_THEME)}`); + + const logProperty = (property: keyof Electron.NativeTheme) => `${String(property)}=${electron.nativeTheme[property]}`; + this.logService.debug(`[theme main service] electron.nativeTheme: ${logProperty('themeSource')}, ${logProperty('shouldUseDarkColors')}, ${logProperty('shouldUseHighContrastColors')}, ${logProperty('shouldUseInvertedColorScheme')}, ${logProperty('shouldUseDarkColorsForSystemIntegratedUI')} `); + this.logService.debug(`[theme main service] New color scheme: ${JSON.stringify(this.getColorScheme())}`); + } } private updateSystemColorTheme(): void {