Class ThemeObserver
Index
Constructors
Accessors
Methods
Constructors
constructor
- new ThemeObserver(): ThemeObserver
Returns ThemeObserver
Accessors
Static
stores
Static
themeName
- get themeName(): string
Returns string
Current theme name; may be different from the theme token.
Static
themeToken
- get themeToken(): string
Returns string
Current theme token - CSS class.
Methods
Static
hasThemedTokens
- hasThemedTokens(
tokens: Iterable<string>,
options?: { strict?: boolean },
): boolean Detect if theming tokens (CSS classes) are present in the given iterable list.
Parameters
- tokens: Iterable<string>
a token list to verify if any theming tokens are included.
Optional
options: { strict?: boolean }Optional parameters.
Optional
strict?: booleanWhen true, all theming tokens required if multiple are verified.
Returns boolean
True if theming tokens present.
- tokens: Iterable<string>
Static
isTheme
Static
nearestThemedTokens
- nearestThemedTokens(
options: {
element: EventTarget | Element;
output?: Set<string>;
override?: boolean;
strict?: boolean;
},
): Iterable<string> Determine the nearest theme tokens (CSS classes) from the given element.
Parameters
- options: {
element: EventTarget | Element;
output?: Set<string>;
override?: boolean;
strict?: boolean;
}Required options.
element: EventTarget | Element
A DOM element.
Optional
output?: Set<string>An optional source Set of existing tokens.
Optional
override?: booleanWhen true, override any existing theme tokens.
Optional
strict?: booleanWhen true, ensure all required theming tokens in output.
Returns Iterable<string>
Any theming tokens found from the given element.
- options: {
Provides reactive observation of the Foundry core theme applied to
document.body
. There are several stores available to receive updates when the theme changes.