Files
laadpalenviewer/webapp/lib/colors.ts
T
Robbert JanssenandClaude Opus 4.8 ab9ed8abb8 Initial commit: Laadpalenviewer
Static-generation EV charging map for the Netherlands with two layers
(passenger / logistics-freight), per-municipality crop-outs, and
gemeente + province boundaries from PDOK/CBS.

- data-pipeline/ (Node/TS): NDW OCPI download + classify (freight >=350kW /
  MCS / megawatt / Milence,WattHub) + external sources (curated, OCM, EAFO)
  + PDOK CBS boundaries -> static GeoJSON/JSON.
- webapp/ (Next.js 16 + React 19 + deck.gl + MapLibre): national view loads
  all points without details; selecting a gemeente eagerly loads its detail
  bundle (OCPI EVSE/connector/tariff + status) for instant marker clicks.
  Passenger colored by OCPI status (fleetsim-style), freight amber/megawatt.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 15:26:56 +02:00

45 lines
1.4 KiB
TypeScript

// Color palettes for the deck.gl layers and legend.
import type { AggregateStatus } from "@/types/charging";
export type RGBA = [number, number, number, number];
// Passenger points: colored by OCPI status (fleetsim-style).
export const STATUS_AVAILABLE: RGBA = [34, 197, 94, 210]; // green-500
export const STATUS_CHARGING: RGBA = [59, 130, 246, 210]; // blue-500
export const STATUS_UNAVAILABLE: RGBA = [239, 68, 68, 210]; // red-500
export const STATUS_UNKNOWN: RGBA = [107, 114, 128, 200]; // gray-500
// Freight points: amber/orange; megawatt = red-orange.
export const FREIGHT: RGBA = [245, 158, 11, 235]; // amber-500
export const FREIGHT_MEGAWATT: RGBA = [234, 88, 12, 245]; // orange-600
export const BOUNDARY_LINE: RGBA = [79, 70, 229, 200]; // indigo-600
export function statusColor(status: AggregateStatus): RGBA {
switch (status) {
case "AVAILABLE":
return STATUS_AVAILABLE;
case "CHARGING":
return STATUS_CHARGING;
case "UNAVAILABLE":
return STATUS_UNAVAILABLE;
default:
return STATUS_UNKNOWN;
}
}
export function freightColor(isMegawatt: boolean): RGBA {
return isMegawatt ? FREIGHT_MEGAWATT : FREIGHT;
}
// Hex equivalents for legend / UI swatches.
export const LEGEND = {
available: "#22c55e",
charging: "#3b82f6",
unavailable: "#ef4444",
unknown: "#6b7280",
freight: "#f59e0b",
freightMegawatt: "#ea580c",
boundary: "#4f46e5",
};