ThemeManager
Table of contents
Manages the editor's color themes.
Stores named theme definitions (each containing light and dark color palettes alongside shared properties like font size). The current theme is resolved by combining the current theme name with the user's color mode preference.
Terminology: - Theme (TLTheme): A named set of colors and typographic values for both light and dark modes. - Color mode ('light' | 'dark'): The resolved appearance mode, derived from the user's colorScheme preference ('light' | 'dark' | 'system'). Access via getColorMode().
class ThemeManager {}Constructor
Constructs a new instance of the ThemeManager class
Parameters
| Name | Description |
|---|---|
| |
| |
Methods
dispose( )
Clean up any resources held by the manager.
dispose(): void;getColorMode( )
Get the current color mode based on the user's dark mode preference.
getColorMode(): "dark" | "light";getCurrentTheme( )
getCurrentTheme(): TLTheme;getCurrentThemeId( )
Get the id of the current theme.
getCurrentThemeId(): TLThemeId;getTheme( )
Get a single theme definition by id.
Parameters
| Name | Description |
|---|---|
|
Returns
TLTheme | undefined;getThemes( )
Get all registered theme definitions.
getThemes(): TLThemes;setCurrentTheme( )
Set the current theme by id. The theme must have been previously registered.
setCurrentTheme(id: TLThemeId): void;Parameters
| Name | Description |
|---|---|
|
Returns
void;updateTheme( )
Register or update a named theme definition.
updateTheme(theme: TLTheme): void;Parameters
| Name | Description |
|---|---|
|
Returns
void;updateThemes( )
Replace all theme definitions, or update them via a callback that receives a deep copy.
Parameters
Returns
void;