Function setVariables

  • Sets CSS variables.

    const vars = {
    my_var: `red`,
    my_size: 10
    }

    // Set to document.body
    setVariables(vars);

    // Set to an element
    setVariables(vars, elem);

    // Or to a CSSStyleDeclaration
    setVariables(vars, styles);

    Type Parameters

    • T extends Record<string, string | number>

    Parameters

    • variables: T
    • OptionalstylesOrEl: HTMLElement | CSSStyleDeclaration

    Returns void