g3-toolkit API Reference
    Preparing search index...

    Function themeFromCssVariables

    • Derive a theme from a host's own CSS custom properties, read through getComputedStyle on element (so a variable declared on :root or any ancestor resolves, with var() chains and fallbacks already applied). mapping names the host variable per theme field; a variable that resolves to nothing leaves the base value in place rather than writing an empty color.

      The result is a SNAPSHOT: computed values do not update when the host switches its theme, so re-derive and re-apply on the host's theme change (the same effect that flips it, or a MutationObserver on the attribute it toggles). The contrast warnings come from createTheme and apply only to plain hex values; rgb() strings, which getComputedStyle may return, are skipped, not failed.

      Parameters

      Returns G3tTheme