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 aebec0f

Browse files
Live change of theme from Preferences dropdown (#1296)
1 parent 54db9bb commit aebec0f

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

‎arduino-ide-extension/src/browser/dialogs/settings/settings-component.tsx‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,7 @@ export class SettingsComponent extends React.Component<
201201
<div className="flex-line">
202202
<select
203203
className="theia-select"
204-
value={
205-
ThemeService.get()
206-
.getThemes()
207-
.find(({ id }) => id === this.state.themeId)?.label ||
208-
nls.localize('arduino/common/unknown', 'Unknown')
209-
}
204+
value={ThemeService.get().getCurrentTheme().label}
210205
onChange={this.themeDidChange}
211206
>
212207
{ThemeService.get()
@@ -591,6 +586,9 @@ export class SettingsComponent extends React.Component<
591586
const theme = ThemeService.get().getThemes()[selectedIndex];
592587
if (theme) {
593588
this.setState({ themeId: theme.id });
589+
if (ThemeService.get().getCurrentTheme().id !== theme.id) {
590+
ThemeService.get().setCurrentTheme(theme.id);
591+
}
594592
}
595593
};
596594

‎arduino-ide-extension/src/browser/dialogs/settings/settings-dialog.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { SettingsComponent } from './settings-component';
1616
import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization';
1717
import { AdditionalUrls } from '../../../common/protocol';
1818
import { AbstractDialog } from '../../theia/dialogs/dialogs';
19+
import { ThemeService } from '@theia/core/lib/browser/theming';
1920

2021
@injectable()
2122
export class SettingsWidget extends ReactWidget {
@@ -118,6 +119,17 @@ export class SettingsDialog extends AbstractDialog<Promise<Settings>> {
118119

119120
this.widget.activate();
120121
}
122+
123+
override async open(): Promise<Promise<Settings> | undefined> {
124+
const themeIdBeforeOpen = ThemeService.get().getCurrentTheme().id;
125+
const result = await super.open();
126+
if (!result) {
127+
if (ThemeService.get().getCurrentTheme().id !== themeIdBeforeOpen) {
128+
ThemeService.get().setCurrentTheme(themeIdBeforeOpen);
129+
}
130+
}
131+
return result;
132+
}
121133
}
122134

123135
export class AdditionalUrlsDialog extends AbstractDialog<string[]> {

0 commit comments

Comments
(0)

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