-
-
Notifications
You must be signed in to change notification settings - Fork 431
/
Copy paththeming.ts
35 lines (33 loc) · 1.07 KB
/
theming.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { ApplicationProps } from '@theia/application-package/lib/application-props';
import { ThemeService as TheiaThemeService } from '@theia/core/lib/browser/theming';
import type { Theme } from '@theia/core/lib/common/theme';
import { injectable } from '@theia/core/shared/inversify';
@injectable()
export class ThemeService extends TheiaThemeService {
override get defaultTheme(): Theme {
// TODO: provide a PR in Theia to support `light` and `dark` themes natively.
return (
this.themes[ArduinoThemes.Default.id] ||
this.themes[ApplicationProps.DEFAULT.frontend.config.defaultTheme]
);
}
}
export namespace ArduinoThemes {
export const Light: Theme = {
id: 'arduino-theme',
type: 'light',
label: 'Light (Arduino)',
editorTheme: 'arduino-theme',
};
export const Dark: Theme = {
id: 'arduino-dark-theme',
type: 'dark',
label: 'Dark (Arduino)',
editorTheme: 'arduino-dark-theme',
};
export const Default =
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches
? Dark
: Light;
}