Theme¶
- class Theme()¶
The theme class which provides support to access theme settings, and to switch between different themes & the theme mode.
Hint
The Theme can also be accessed through the meta object.
- Theme.currentMode¶
The currently activated mode.
- Theme.currentTheme¶
The currently activated theme.
- Theme.userMode¶
The user-preferred mode.
- Theme.userTheme¶
The user-preferred theme.
- static Theme.activateMode(mode, ephemeral)¶
Activate a specific theme mode.
- Arguments:
mode (String) – The theme mode [light|dark]
ephemeral (Boolean) – Do not store the theme mode persistently
- static Theme.activateTheme(theme, ephemeral)¶
Load and activate a specific theme.
- Arguments:
theme (String) – The theme name
ephemeral (Boolean) – Do not store the theme persistently
- static Theme.getClass(prefix)¶
Get a CSS class with a certain prefix.
When talking about prefixes, then we talk about the following format:
{prefix}-{value}
- Arguments:
prefix (String) – The prefix
- Returns:
String – The current value
- static Theme.handleEvents()¶
Handle all events sent by the following theme-related components:
ThemeSwitcher
ThemeModeSwitcher
ThemePreferencesResetter
- static Theme.initialise()¶
Initialise the theme executing the following tasks:
Set the project preferences (see
currentTheme()
andcurrentMode()
Call
handleEvents()
Important
This method is automatically called once, when the document is loaded.
- static Theme.initialiseUserPreferences()¶
Initialise the user preferences.
- static Theme.log(...message)¶
Log a debug message.
- Arguments:
message (Array) – The message
- static Theme.removeClass(prefix)¶
Remove a CSS class with a certain prefix.
When talking about prefixes, then we talk about the following format:
{prefix}-{value}
- Arguments:
prefix (String) – The prefix
- static Theme.replaceClass(prefix, value)¶
Replace a CSS class with a certain prefix.
When talking about prefixes, then we talk about the following format:
{prefix}-{value}
- Arguments:
prefix (String) – The prefix
value (String) – The new value
- static Theme.resetPreferences()¶
Reset the user preferences and initialise the theme again.
- static Theme.toggleMode()¶
Toggle the theme mode between light and dark.