Riksdagsmonitor Intelligence Platform - v0.7.19
    Preparing search index...

    Function getActiveThemeColors

    • Returns the active ThemeColors based on the current data-theme attribute on <html>. When the attribute is absent (e.g. before the anti-flash snippet runs), falls back to prefers-color-scheme — consistent with the CSS @media (prefers-color-scheme: dark) default. Defaults to DARK_THEME_COLORS only in SSR / test environments where document is undefined; in a browser without matchMedia support it defaults to LIGHT_THEME_COLORS (matching the CSS :root base styles).

      Call this wherever Chart.js datasets need the current palette, e.g.:

      const colors = getActiveThemeColors();
      chart.data.datasets[0].backgroundColor = colors.cyan;

      Returns ThemeColors