Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/chart-config-colors-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@objectstack/spec": patch
---

feat(spec): type ChartConfig `colors` as a palette OR a value→color map

`ChartConfigSchema.colors` now accepts either a positional palette (`string[]`)
or an explicit value→color map (`Record<value, color>`, kanban-style). A
value→color map — and a select/lookup dimension's option colors — take
precedence over the positional palette per category, so semantic charts
(health, status) paint their own colors instead of the generic palette.
11 changes: 9 additions & 2 deletions packages/spec/src/ui/chart.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,15 @@ export const ChartConfigSchema = lazySchema(() => z.object({
/** Series Configuration */
series: z.array(ChartSeriesSchema).optional().describe('Defined series configuration'),

/** Appearance */
colors: z.array(z.string()).optional().describe('Color palette'),
/** Appearance. Either a positional palette (string[]) applied per category in
* order, or a value→color map ({ value: color }, kanban-style). A value→color
* map — and a select/lookup dimension's option colors — take precedence over
* the positional palette per category, so semantic charts (health, status)
* paint their own colors instead of the generic palette. */
colors: z.union([
z.array(z.string()),
z.record(z.string(), z.string()),
]).optional().describe('Color palette (string[]) or value→color map ({ value: color })'),
height: z.number().optional().describe('Fixed height in pixels'),

/** Components */
Expand Down