Constructs the ThemeBaseService.
The global document object.
The MediaMatcher service used to match media queries.
Protected ReadonlydarkMedia query used to detect if the user's system prefers a dark theme.
Protected ReadonlydocumentThe global document object.
Protected ReadonlymediaThe MediaMatcher service used to match media queries.
ReadonlystorageInlineStorage instance that manages the current theme in local storage.
The theme is stored with a key of 'theme', and
the default theme is the first element in THEMES.
ReadonlythemeEventEmitter that triggers whenever the theme changes.
Subscribers can use this to react to theme changes in real-time.
The value of the [data-bs-theme] attribute
from the <html> element.
Sets the theme in the [data-bs-theme] attribute of the <html> element.
The new theme to set. Must be one of the THEMES.
ProtectedhtmlThe <html> HTML element of the document.
true if the current theme is set
to auto; otherwise, false.
true if the current theme is dark; otherwise, false.
true if the current theme is light; otherwise, false.
The current theme, validated against the available themes.
If the stored theme is not in THEMES, it falls back to the default theme.
Changes the current theme.
The new theme to apply. Must be one of the THEMES.
Initializes the theme service.
This method must be called during the application's initialization process. It sets the initial theme and attaches an event listener to handle changes in the system's color scheme preference.
ProtectedsetSets the theme and updates the [data-bs-theme]
attribute of the <html> element.
This method ensures that the theme is stored in local storage and applies the appropriate theme based on the current settings and system preferences.
The theme to set. Must be one of the THEMES.
Service for managing the application's theme.
This service is responsible for storing the selected theme in local storage and applying it to the application. It also supports live theme changes based on user preference or system settings.
This service is best used in conjunction with a Bootstrap-based application that supports both light and dark themes.
Usage: