Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ export class SettingsService {
this.preferenceService.get<number>(FONT_SIZE_SETTING, 12),
this.preferenceService.get<string>(
'workbench.colorTheme',
'arduino-theme'
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
? 'arduino-theme-dark'
: 'arduino-theme'
),
this.preferenceService.get<Settings.AutoSave>(
AUTO_SAVE_SETTING,
Expand Down
23 changes: 18 additions & 5 deletions electron/build/patch/frontend/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ const {
const {
ApplicationProps,
} = require('@theia/application-package/lib/application-props');
const {
FrontendApplicationConfigProvider,
} = require('@theia/core/lib/browser/frontend-application-config-provider');

const lightTheme = 'arduino-theme';
const darkTheme = 'arduino-theme-dark';
Expand All @@ -21,22 +24,28 @@ const defaultTheme =
? darkTheme
: lightTheme;

const originalGet = FrontendApplicationConfigProvider.get;
FrontendApplicationConfigProvider.get = function () {
const originalProps = originalGet.bind(FrontendApplicationConfigProvider)();
return { ...originalProps, defaultTheme };
}.bind(FrontendApplicationConfigProvider);

const arduinoDarkTheme = {
id: 'arduino-theme-dark',
type: 'dark',
label: 'Dark (Arduino)',
editorTheme: 'arduino-theme-dark',
activate() { },
deactivate() { }
activate() {},
deactivate() {},
};

const arduinoLightTheme = {
id: 'arduino-theme',
type: 'light',
label: 'Light (Arduino)',
editorTheme: 'arduino-theme',
activate() { },
deactivate() { }
activate() {},
deactivate() {},
};

if (!window[ThemeServiceSymbol]) {
Expand All @@ -49,7 +58,11 @@ if (!window[ThemeServiceSymbol]) {
);
},
});
themeService.register(...BuiltinThemeProvider.themes, arduinoDarkTheme, arduinoLightTheme);
themeService.register(
...BuiltinThemeProvider.themes,
arduinoDarkTheme,
arduinoLightTheme
);
themeService.startupTheme();
themeService.setCurrentTheme(defaultTheme);
window[ThemeServiceSymbol] = themeService;
Expand Down