SPB Git

Repository Public

tokens.ts 4.1 KB 152 lines typescript

1/**2 * Author: Simon-Pierre Boucher3 * Contact: contact@spboucher.ai4 * Project: Groupe Ka / Ka Maps5 *6 * Theme contract. Ka Maps ships the base cartography and behavior; each7 * Groupe Ka app supplies one of these objects to make the map its own.8 */910export type KaMapMode = "light" | "dark";1112/** Marker/label treatment for one item family (sale, rent, valuation…). */13export interface MarkerStyleTokens {14  /** Pill background. */15  background: string;16  /** Pill text. */17  text: string;18  /** Halo/outline behind the pill for map contrast. */19  halo: string;20  /** Background when selected. */21  selectedBackground: string;22  /** Text when selected. */23  selectedText: string;24}2526/** Basemap palette — one per mode, derived from the Ka base cartography. */27export interface BasemapPalette {28  background: string;29  water: string;30  waterway: string;31  park: string;32  wood: string;33  residential: string;34  building: string;35  buildingOutline: string;36  road: string;37  roadCasing: string;38  roadSecondary: string;39  primary: string;40  primaryCasing: string;41  motorway: string;42  motorwayCasing: string;43  boundary: string;44  label: string;45  labelHalo: string;46  cityLabel: string;47  roadLabel: string;48  waterLabel: string;49}5051export interface KaMapTheme {52  /** App identity: "lou-ka" | "immo-ka" | "vrai-prix" | future apps. */53  id: string;54  /** Product name shown in attribution/UI, e.g. "Lou-Ka Maps". */55  productName: string;56  /** Primary accent (controls, selection ring, active states). */57  accent: string;58  /** Text color readable on `accent`. */59  onAccent: string;60  /** UI font stack for controls/popups (CSS font-family). */61  fontFamily: string;62  /** Marker styles per item family. Absent families fall back to `sale`. */63  markers: {64    sale: MarkerStyleTokens;65    rent?: MarkerStyleTokens;66    valuation?: MarkerStyleTokens;67    /** Emphasized items (MapProperty.highlight), e.g. under-valuation deals. */68    highlight?: MarkerStyleTokens;69  };70  /** Cluster bubble styling. */71  cluster: {72    background: string;73    text: string;74    border: string;75  };76  /** Optional per-app overrides merged over the Ka base palettes. */77  basemapOverrides?: {78    light?: Partial<BasemapPalette>;79    dark?: Partial<BasemapPalette>;80  };81  /** Whether the app supports dark mode at all. */82  supportsDark: boolean;83}8485/** Ka Light Map — restrained warm-paper cartography for property discovery. */86export const KA_LIGHT_PALETTE: BasemapPalette = {87  background: "#f5f3ee",88  water: "#c9dbe4",89  waterway: "#c2d6e0",90  park: "#dbe7d2",91  wood: "#d3e2ca",92  residential: "#efece5",93  building: "#e6e0d5",94  buildingOutline: "#d9d2c4",95  road: "#ffffff",96  roadCasing: "#e0dacd",97  roadSecondary: "#fdf8ec",98  primary: "#f6d17c",99  primaryCasing: "#cfa14a",100  motorway: "#e0584c",101  motorwayCasing: "#ad342d",102  boundary: "#b3a794",103  label: "#4d473c",104  labelHalo: "rgba(245, 243, 238, 0.9)",105  cityLabel: "#38332a",106  roadLabel: "#7a7364",107  waterLabel: "#5d7f91",108};109110/** Ka Dark Map — purpose-designed night cartography (not an inversion). */111export const KA_DARK_PALETTE: BasemapPalette = {112  background: "#14161a",113  water: "#0b1218",114  waterway: "#0e1620",115  park: "#18211a",116  wood: "#161f18",117  residential: "#171a1f",118  building: "#1d2126",119  buildingOutline: "#242930",120  road: "#242931",121  roadCasing: "#0f1114",122  roadSecondary: "#2a2f37",123  primary: "#3c3a30",124  primaryCasing: "#23211b",125  motorway: "#7e352c",126  motorwayCasing: "#4c1f19",127  boundary: "#4a4f58",128  label: "#b9bec7",129  labelHalo: "rgba(20, 22, 26, 0.9)",130  cityLabel: "#dfe3e9",131  roadLabel: "#8a9099",132  waterLabel: "#5f7f93",133};134135/** Merge app overrides over a base palette. */136export function resolvePalette(137  mode: KaMapMode,138  theme: KaMapTheme,139): BasemapPalette {140  const base = mode === "dark" ? KA_DARK_PALETTE : KA_LIGHT_PALETTE;141  const overrides = theme.basemapOverrides?.[mode];142  return overrides ? { ...base, ...overrides } : base;143}144145/** Marker tokens for an item family, falling back to `sale`. */146export function markerTokens(147  theme: KaMapTheme,148  family: "sale" | "rent" | "valuation" | "highlight",149): MarkerStyleTokens {150  return theme.markers[family] ?? theme.markers.sale;151}152
Files laptop-20261002
Menu

Theme