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.

979 B
Raw Blame
import type { ThemeColorParams } from '@macro-inc/email-renderer/browser';
import { resolvedThemeColors } from '@theme/signals/themeSignals';
import { createMemo } from 'solid-js';

/** Only recolor email HTML when a color used by its contrast algorithm changes. */
export function createEmailTheme() {
  return createMemo<ThemeColorParams, undefined>(
    () => {
      const colors = resolvedThemeColors();
      const ink = colors['content-0'];
      const accent = colors.accent;
      return {
        inkL: ink.l,
        inkC: ink.c,
        inkH: ink.h,
        panelL: colors['surface-1'].l,
        accentL: accent.l,
        accentC: accent.c,
        accentH: accent.h,
      };
    },
    undefined,
    {
      equals: (a, b) =>
        a.inkL === b.inkL &&
        a.inkC === b.inkC &&
        a.inkH === b.inkH &&
        a.panelL === b.panelL &&
        a.accentL === b.accentL &&
        a.accentC === b.accentC &&
        a.accentH === b.accentH,
    }
  );
}