Skip to main content

applyTheme

@blockslides/core


@blockslides/core / applyTheme

Function: applyTheme()

applyTheme(theme, element): void

Defined in: blockslides/packages/core/src/themes/resolver.ts:139

Apply theme to DOM element using CSS custom properties

Sets CSS variables on the element that can be used by stylesheets. Also sets a data-theme attribute for additional CSS targeting. If theme is null, removes all theme-related attributes and CSS variables.

Parameters

theme

ResolvedTheme

Resolved theme to apply (or null to remove theme)

element

HTMLElement

DOM element to apply theme to

Returns

void