ElectronNativeTheme
Unofficial
Electron NativeTheme for reading and updating the system’s theme preferences.
Import:
import type { ElectronNativeTheme } from '@obsidian-typings/obsidian-public-latest';Signature:
export interface ElectronNativeThemeProperties
| Property | Type | Description | |
|---|---|---|---|
| inForcedColorsMode | boolean | A boolean indicating whether Chromium is in forced colors mode, controlled by system accessibility settings. Currently, Windows high contrast is the only system setting that triggers forced colors mode.Platform: win32. | |
| shouldUseDarkColors | boolean | A boolean for if the OS / Chromium currently has a dark mode enabled or is being instructed to show a dark-style UI. If you want to modify this value you should use themeSource below. | |
| shouldUseHighContrastColors | boolean | A boolean for if the OS / Chromium currently has high-contrast mode enabled or is being instructed to show a high-contrast UI.Platform: darwin,win32. | |
| shouldUseInvertedColorScheme | boolean | A boolean for if the OS / Chromium currently has an inverted color scheme or is being instructed to use an inverted color scheme.Platform: darwin,win32. | |
| themeSource | 'dark' | 'light' | 'system' | A string property that can be system, light or dark. It is used to override and supersede the value that Chromium has chosen to use internally. Setting this property to system will remove the override and everything will be reset to the OS default. |
Methods
| Method | Returns | Description | |
|---|---|---|---|
| addListener(event, listener) | this | Adds a listener for the updated event.Emitted when something in the underlying NativeTheme has changed. This normally means that either the value of shouldUseDarkColors, shouldUseHighContrastColors or shouldUseInvertedColorScheme has changed. You will have to check them to determine which one has changed. | |
| on('updated', listener) | this | Registers a listener for the updated event. | |
| once(event, listener) | this | Registers a one-time listener for the updated event. The listener is removed after it is invoked once. | |
| removeListener(event, listener) | this | Removes the specified listener for the updated event. |
Links to this page: