Skip to content

SiThemeStore Type documentation

SiThemeStore object is used by the theme service to load and store the themes. You can inject your own implementation to provide a backend implementation. Otherwise a localStorage based implementation is used.
Constructor
() => {}
Methods
Sets the theme with the given name to active.
Returns True on success, otherwise false.
Parameters
The name of the theme to become active.
name: string
Deactivate any active theme and makes the element theme the default one.
Returns True on success, otherwise false.

deactivateTheme: () => Observable<boolean>
Deletes the theme with the given name from the store.
Returns True on success, otherwise false. All nicely wrapped in an observable that may also emit errors. Returns false, if the theme does not exist.
Parameters
The name of the theme to be deleted.
name: string
Load and return an alternative custom theme, other then the default element theme. This method is invoked initially to check for an alternative custom theme.
Returns The active theme to be used, or undefined if the default element theme shall be used. All wrapped in an observable that can also emit errors.

loadActiveTheme: () => Observable<(undefined | Theme)>
Load theme with the given name .
Returns Observable with the named theme or undefined if no such theme exist.
Parameters
The name of the theme to be returned.
name: string
Load and return the available theme names.
Returns An Observable of available theme names, other than the default element theme.

loadThemeNames: () => Observable<string[]>
Saves a theme to the store. The name shall not be empty. A theme with identical name gets overwritten.
Returns True on success, otherwise false. All nicely wrapped in an observable that may also emit errors.
Parameters
The theme to be saved.
theme: Theme

Types Documentation

Properties
A map of icons that overrides the default Element icons. The key must be the key of the original icon that should be overridden. The value has to be a data SVG string.

Example:
{
  elementUser: "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'>...</svg>"
}
icons?: Record<string, string>
name: string
schemes: ThemeColorSchemes
Properties
dark?: ThemeColorScheme
light?: ThemeColorScheme

Except where otherwise noted, content on this site is licensed under MIT License.