Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f22be3c

Browse files
davegarthsimpsonAkos Kitta
and
Akos Kitta
authored
#1223: use theme service on settings load (#1238)
* use theme service on settings load * use window.matchMedia in loadSettings * typo fix * Patched app config to dispatch on OS' theme. Signed-off-by: Akos Kitta <a.kitta@arduino.cc> Co-authored-by: Akos Kitta <a.kitta@arduino.cc>
1 parent 9373a0b commit f22be3c

File tree

2 files changed

+22
-6
lines changed
  • arduino-ide-extension/src/browser/dialogs/settings
  • electron/build/patch/frontend

2 files changed

+22
-6
lines changed

‎arduino-ide-extension/src/browser/dialogs/settings/settings.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,10 @@ export class SettingsService {
139139
this.preferenceService.get<number>(FONT_SIZE_SETTING, 12),
140140
this.preferenceService.get<string>(
141141
'workbench.colorTheme',
142-
'arduino-theme'
142+
window.matchMedia &&
143+
window.matchMedia('(prefers-color-scheme: dark)').matches
144+
? 'arduino-theme-dark'
145+
: 'arduino-theme'
143146
),
144147
this.preferenceService.get<Settings.AutoSave>(
145148
AUTO_SAVE_SETTING,

‎electron/build/patch/frontend/index.js‎

Lines changed: 18 additions & 5 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /