Skip to content

Commit 387e52b

Browse files
author
Akos Kitta
committed
Patched app config to dispatch on OS' theme.
Signed-off-by: Akos Kitta <[email protected]>
1 parent e9c2613 commit 387e52b

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

Diff for: electron/build/patch/frontend/index.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const {
1313
const {
1414
ApplicationProps,
1515
} = require('@theia/application-package/lib/application-props');
16+
const {
17+
FrontendApplicationConfigProvider,
18+
} = require('@theia/core/lib/browser/frontend-application-config-provider');
1619

1720
const lightTheme = 'arduino-theme';
1821
const darkTheme = 'arduino-theme-dark';
@@ -21,22 +24,28 @@ const defaultTheme =
2124
? darkTheme
2225
: lightTheme;
2326

27+
const originalGet = FrontendApplicationConfigProvider.get;
28+
FrontendApplicationConfigProvider.get = function () {
29+
const originalProps = originalGet.bind(FrontendApplicationConfigProvider)();
30+
return { ...originalProps, defaultTheme };
31+
}.bind(FrontendApplicationConfigProvider);
32+
2433
const arduinoDarkTheme = {
2534
id: 'arduino-theme-dark',
2635
type: 'dark',
2736
label: 'Dark (Arduino)',
2837
editorTheme: 'arduino-theme-dark',
29-
activate() { },
30-
deactivate() { }
38+
activate() {},
39+
deactivate() {},
3140
};
3241

3342
const arduinoLightTheme = {
3443
id: 'arduino-theme',
3544
type: 'light',
3645
label: 'Light (Arduino)',
3746
editorTheme: 'arduino-theme',
38-
activate() { },
39-
deactivate() { }
47+
activate() {},
48+
deactivate() {},
4049
};
4150

4251
if (!window[ThemeServiceSymbol]) {
@@ -49,7 +58,11 @@ if (!window[ThemeServiceSymbol]) {
4958
);
5059
},
5160
});
52-
themeService.register(...BuiltinThemeProvider.themes, arduinoDarkTheme, arduinoLightTheme);
61+
themeService.register(
62+
...BuiltinThemeProvider.themes,
63+
arduinoDarkTheme,
64+
arduinoLightTheme
65+
);
5366
themeService.startupTheme();
5467
themeService.setCurrentTheme(defaultTheme);
5568
window[ThemeServiceSymbol] = themeService;

0 commit comments

Comments
 (0)