Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

733 B
Raw Blame
import type { ThemeV3 } from '../types/themeTypes';
import { buttonAccentVars } from './buttonTheme';
import { resolveThemeColors } from './resolvedThemeColors';
import {
  normalizeThemeColorTokens,
  themeTokenCssVar,
} from './themeColorTokens';

/** Render a subtree theme with the same authored and derived values as the root. */
export function themeCssVars(theme: ThemeV3): Record<string, string> {
  const tokens = normalizeThemeColorTokens(theme.colorTokens, theme.mode);
  const vars = buttonAccentVars(resolveThemeColors(tokens, theme.mode));
  for (const [token, value] of Object.entries(tokens)) {
    const mapped = themeTokenCssVar(token, value);
    if (mapped) vars[mapped.name] = mapped.value;
  }
  return vars;
}