Class ThemeObserver
Index
Constructors
Accessors
Methods
Constructors
constructor
Returns ThemeObserver
Accessors
Staticstores
StaticthemeName
- get themeName(): string
Returns string
Current theme name; may be different from the theme token.
StaticthemeToken
- get themeToken(): string
Returns string
Current theme token - CSS class.
Methods
StatichasThemedTokens
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.
Optionaloptions: { strict?: boolean }Optional parameters.
Optionalstrict?: booleanWhen true, all theming tokens required if multiple are verified.
Returns boolean
True if theming tokens present.
- tokens: Iterable<string>
StaticisTheme
Verify that the given
themename or token (CSS class) is the current platform theme.Parameters
- theme: string
A theme name or token to verify.
Returns boolean
If the requested theme matches the current platform theme.
- theme: string
StaticnearestThemedTokens
- 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.
Optionaloutput?: Set<string>An optional source Set of existing tokens.
Optionaloverride?: booleanWhen true, override any existing theme tokens.
Optionalstrict?: 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.