All files / src/components/theme accents.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                                            3x                                 3x     3x                
import { BRAND_RAMP } from "chainr-frontend-shared";
 
/**
 * The accent family the marketing pages tint cards and section labels with.
 *
 * Contact, Help and Services each declared these as raw hex on their own data
 * objects (`accent: "#2563eb"`), and the docs pages declared three of them
 * again as category colours. The values now come from `BRAND_RAMP` in
 * `chainr-frontend-shared`, which is also what the theme accent picker draws
 * from — four of these hexes were byte-identical to that palette's, written
 * out twice in two packages.
 *
 * The *shape* stays local on purpose. The theme palette is a labelled list a
 * user picks from; this is a fixed lookup with no labels and no user choice,
 * because fe-public has no signed-in viewer to have a preference. One set of
 * colours, two structures over it.
 *
 * These are plain hex rather than Tailwind classes because every use is an
 * inline `style={{ color: accent }}` on content whose colour is chosen by
 * data, not by markup — Tailwind cannot see a class name assembled at runtime,
 * so it would purge it.
 */
export type AccentName =
  | "blue"
  | "violet"
  | "cyan"
  | "emerald"
  | "amber"
  | "pink";
 
export const ACCENTS: Record<AccentName, string> = {
  blue: BRAND_RAMP.blue,
  violet: BRAND_RAMP.violet,
  cyan: BRAND_RAMP.cyan,
  emerald: BRAND_RAMP.emerald,
  amber: BRAND_RAMP.amber,
  pink: BRAND_RAMP.pink,
};
 
/**
 * The primary brand blue, used for section eyebrows and emphasis.
 *
 * Deliberately *not* `ACCENTS.blue`: this is the lighter 500-level blue, which
 * is what reads correctly as text on the page background — the 600-level card
 * tint goes muddy at small sizes. It matches fe-core's `tones.ts` blue, the
 * other place the 500 ramp is used.
 */
export const BRAND_BLUE = "#3b82f6";
 
/** The accent family in display order, for pages that assign one per item. */
export const ACCENT_CYCLE: string[] = [
  ACCENTS.blue,
  ACCENTS.violet,
  ACCENTS.cyan,
  ACCENTS.emerald,
  ACCENTS.amber,
  ACCENTS.pink,
];