Skip to content

ThemeService

Class | Source Code

Provides means by which to register themes, change the active theme, and listen to when the theme changes. Also includes helper methods for dealing with themes and colors.

A lighter theme with an off-white background, deep chocolates for text, beautiful blue buttons, and lovely lavender accents.


Event for when the current theme changes or is modified.


A classic light theme, featuring blue buttons and aqua accents.


A default theme you can use to get going. This theme is NOT in the set of registered themes, but will be used to set the theme CSS variables by default. Same as ThemeService.dark.


A dark theme that primarily uses shades of gray with pops of soft blue for buttons and an aqua for accent.


updateTheme(themeName: string, newThemeData: Partial<Omit<Theme, “name”>>): void

Section titled “updateTheme(themeName: string, newThemeData: Partial<Omit<Theme, “name”>>): void”

Updates the specified theme, modifying its registered data.


registerTheme(theme: Theme, autoSetCurrent: boolean): void

Section titled “registerTheme(theme: Theme, autoSetCurrent: boolean): void”

Registers the specified theme with the service, allowing the theme to be used as the current theme. If the theme shares a name with an already-registered theme, nothing happens.


lighten(hexColor: string, amount: number): string

Section titled “lighten(hexColor: string, amount: number): string”

Lightens a hex color.

The lightened color.


darken(hexColor: string, amount: number): string

Section titled “darken(hexColor: string, amount: number): string”

Darkens a hex color.

The darkened color.


Changes the theme to the specified one if the specified theme has been registered with the service. If the specified theme is found, the current theme is updated and the onChangeTheme event is invoked.