Skip to main content
function themeToCssVariables(theme: Record<string, string>): CDPWebCSSVariables;
Converts a theme object to a CSS variables object for the CDP web component library.

Parameters

ParameterTypeDescription
themeRecord<string, string>The theme object to convert.

Returns

CDPWebCSSVariables A CSS variables object.

Example

const themeOverrides: Partial<Theme> = {
  "color-bg-primary": "red",
};

// { "--cdp-web-color-bg-primary": "red" }
const cssVariables = themeToCssVariables(themeOverrides);