SPB Git forge

spb/countryatlas

Public
20commits 1branches 0releases
268.3 MBsize
maindefault branch
12 days agolast push
TypeScript 57% Python 38.6% JavaScript 3.6% CSS 0.6%
1.2 KB · 44 lines typescript
Raw Blame History
1/**2 * Chart colour roles — all CSS custom properties so light/dark swap without re-render.3 * Categorical slots are assigned in FIXED order (dataviz rule: colour follows the entity, never its rank;4 * never cycle past 8 — fold to "Other" or facet).5 */6export const SERIES_MAX = 8;78export function seriesVar(index: number): string {9  const i = Math.min(Math.max(index, 0), SERIES_MAX - 1) + 1;10  return `var(--series-${i})`;11}1213/** Sequential (choropleth) class fill, k ∈ 1..7 light→dark. */14export function seqVar(step: number): string {15  const i = Math.min(Math.max(step, 1), 7);16  return `var(--seq-${i})`;17}1819export const CHART = {20  ink: 'var(--ink)',21  ink2: 'var(--ink-2)',22  ink3: 'var(--ink-3)',23  rule: 'var(--rule)',24  ruleStrong: 'var(--rule-strong)',25  surface: 'var(--surface)',26  accent: 'var(--accent)',27  accentSoft: 'var(--accent-soft)',28  up: 'var(--up)',29  down: 'var(--down)',30  nodata: 'var(--nodata)',31  forecast: 'var(--forecast)',32} as const;3334/** Mark specs (dataviz marks-and-anatomy): thin marks, 2px lines, ≥8px end dots, 24px max bar thickness. */35export const MARK = {36  line: 2,37  dotR: 4,38  ringW: 2,39  barMax: 24,40  barRadius: 4,41  gap: 2,42  areaOpacity: 0.12,43} as const;44