All files / context accents.ts

100% Statements 6/6
100% Branches 2/2
100% Functions 3/3
100% Lines 5/5

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                                                          2x                   2x   2x 83x 10x  
/**
 * Curated, professional accent palette for the application theme.
 *
 * Each accent drives the primary/brand colour used across both the legacy
 * `--primary-color` variables and the shadcn `--primary`/`--ring` variables.
 * Colours are tuned to read well on both light and dark backgrounds; the
 * `foreground` is the text/icon colour to place on top of the accent.
 */
 
import { BRAND_RAMP } from "./palette";
 
export type AccentId =
  | "blue"
  | "indigo"
  | "violet"
  | "teal"
  | "emerald"
  | "rose"
  | "amber";
 
export interface Accent {
  id: AccentId;
  label: string;
  /** The brand colour applied to primary surfaces, links, and focus rings. */
  color: string;
  /** Text/icon colour to render on top of `color`. */
  foreground: string;
}
 
export const ACCENTS: Accent[] = [
  { id: "blue", label: "Blue", color: BRAND_RAMP.blue, foreground: "#ffffff" },
  { id: "indigo", label: "Indigo", color: BRAND_RAMP.indigo, foreground: "#ffffff" },
  { id: "violet", label: "Violet", color: BRAND_RAMP.violet, foreground: "#ffffff" },
  { id: "teal", label: "Teal", color: BRAND_RAMP.teal, foreground: "#ffffff" },
  { id: "emerald", label: "Emerald", color: BRAND_RAMP.emerald, foreground: "#ffffff" },
  { id: "rose", label: "Rose", color: BRAND_RAMP.rose, foreground: "#ffffff" },
  { id: "amber", label: "Amber", color: BRAND_RAMP.amber, foreground: "#ffffff" },
];
 
export const DEFAULT_ACCENT: AccentId = "blue";
 
export const getAccent = (id: string | null | undefined): Accent =>
  ACCENTS.find((a) => a.id === id) ??
  ACCENTS.find((a) => a.id === DEFAULT_ACCENT)!;