Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
feat(ui): one colour palette for every chart (#3871)
Raghav Chamadiyad510e0d8a88c
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex 6e43abadb..65088a2a6 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- **Charts are in colour again, from one palette.** Every chart and share bar in the web UI draws from the same eight series colours, a commit type keeps one colour on every chart, health and risk charts keep their green, amber and red, heatmaps step through the accent orange, and chat charts sit on the conversation without a card around them.- **One provider order everywhere.** The CLI, `repowise serve` chat and jobs, and the MCP server now resolve provider, model and base URL as flag or UI choice, then `.repowise/config.yaml`, then the web UI's global default, then `REPOWISE_PROVIDER` / `REPOWISE_MODEL`, so `config.yaml` now wins over those env vars in the CLI. Choosing a model or base URL for a repo in the web UI writes that repo's `config.yaml`, which makes switching models on a local OpenAI-compatible server such as LM Studio a single edit. A base URL in `config.yaml` now beats `OPENAI_BASE_URL` and the other `*_BASE_URL` variables. The default provider and model saved in the web UI settings now also apply to CLI runs in repos whose `config.yaml` names none. A `config.yaml` base URL receives an API key from outside that repo's `.repowise/.env` only when it is a local address or was confirmed in Settings or with `repowise init`.- **Current model lists and prices.** Pickers offer GPT-6 Luna and Sol, Claude Sonnet 5.5 and Opus 5.5, Gemini 3.8 Flash and Gemini 4 Argon. DeepSeek now defaults to `deepseek-flash` and LiteLLM to `groq/openai/gpt-oss-120b`, since the old ids were retired. Cost estimates use current rates, and GPT-6 models get the same reasoning, temperature and chat tool handling as GPT-5.6.diff --git a/packages/core/src/repowise/core/upgrade/_data/CHANGELOG.md b/packages/core/src/repowise/core/upgrade/_data/CHANGELOG.mdindex e018265f8..0a9f965fe 100644--- a/packages/core/src/repowise/core/upgrade/_data/CHANGELOG.md+++ b/packages/core/src/repowise/core/upgrade/_data/CHANGELOG.md@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Changed+- **Charts are in colour again, from one palette.** Every chart and share bar in the web UI draws from the same eight series colours, a commit type keeps one colour on every chart, health and risk charts keep their green, amber and red, heatmaps step through the accent orange, and chat charts sit on the conversation without a card around them.- **One provider order everywhere.** The CLI, `repowise serve` chat and jobs, and the MCP server now resolve provider, model and base URL as flag or UI choice, then `.repowise/config.yaml`, then the web UI's global default, then `REPOWISE_PROVIDER` / `REPOWISE_MODEL`, so `config.yaml` now wins over those env vars in the CLI. Choosing a model or base URL for a repo in the web UI writes that repo's `config.yaml`, which makes switching models on a local OpenAI-compatible server such as LM Studio a single edit. A base URL in `config.yaml` now beats `OPENAI_BASE_URL` and the other `*_BASE_URL` variables. The default provider and model saved in the web UI settings now also apply to CLI runs in repos whose `config.yaml` names none. A `config.yaml` base URL receives an API key from outside that repo's `.repowise/.env` only when it is a local address or was confirmed in Settings or with `repowise init`.## [0.56.0] - 2026-10-12diff --git a/packages/ui/__tests__/chat/view-part.test.tsx b/packages/ui/__tests__/chat/view-part.test.tsxindex 08598c0a1..28d44a6a9 100644--- a/packages/ui/__tests__/chat/view-part.test.tsx+++ b/packages/ui/__tests__/chat/view-part.test.tsx@@ -141,12 +141,14 @@ describe("ViewPartList", () => {expect(within(figure).getAllByRole("columnheader")).toHaveLength(8);});- it("separates stacked segments with a seam and lines with dashes", () => {+ it("separates stacked segments by series colour and lines with dashes", () => {const lines: ChartView = { ...STACKED, id: "l2", chart_type: "line" };render(<ViewPartList views={[STACKED, lines]} />);- const segment = part("c2").querySelector(".recharts-bar-rectangle path");- expect(segment).toHaveAttribute("stroke", "var(--color-bg-surface)");+ const segmentFills = [...part("c2").querySelectorAll(".recharts-bar")].map((bar) =>+ bar.querySelector(".recharts-bar-rectangle path")?.getAttribute("fill"),+ );+ expect(segmentFills).toEqual(["var(--color-series-1)", "var(--color-series-2)"]);const dashes = [...part("l2").querySelectorAll(".recharts-line-curve")].map((el) =>el.getAttribute("stroke-dasharray"),);@@ -154,6 +156,12 @@ describe("ViewPartList", () => {expect(new Set(dashes).size).toBe(2);});+ it("sits on the transcript without a card of its own", () => {+ render(<ViewPartList views={[STACKED]} />);+ const figure = part("c2");+ expect(figure.className).not.toMatch(/border|bg-\[/);+ });+it("stacks a stacked bar's segments end to end on one row", () => {render(<ViewPartList views={[STACKED]} />);diff --git a/packages/ui/__tests__/owners/ownership-distribution-bar.test.tsx b/packages/ui/__tests__/owners/ownership-distribution-bar.test.tsxindex 61aa4ae2e..fcd91d7bd 100644--- a/packages/ui/__tests__/owners/ownership-distribution-bar.test.tsx+++ b/packages/ui/__tests__/owners/ownership-distribution-bar.test.tsx@@ -34,8 +34,8 @@ describe("OwnershipDistributionBar", () => {// 167 owned files across the seven loaded contributors.expect(items).toEqual(["dev136%", "dev324%", "dev418%", "dev512%", "dev06%", "35 others4%"]);expect(screen.getByRole("link", { name: /dev1/ })).toHaveAttribute("href", "/owners/dev1");- // The same neutral share steps as every other proportion, never the accent.- expect(container.innerHTML).toContain("--color-share-1");+ // The same series colours as every other proportion, never the accent token.+ expect(container.innerHTML).toContain("--color-series-1");expect(container.innerHTML).not.toContain("accent");});});diff --git a/packages/ui/__tests__/refactoring/structural-field.test.tsx b/packages/ui/__tests__/refactoring/structural-field.test.tsxindex d4c049247..557161eff 100644--- a/packages/ui/__tests__/refactoring/structural-field.test.tsx+++ b/packages/ui/__tests__/refactoring/structural-field.test.tsx@@ -128,8 +128,8 @@ describe("salience", () => {"var(--color-neutral-1)","var(--color-neutral-2)",]);- // globals.css reserves --color-share-* for shares of a whole; these are categories.- expect(fills.some((f) => f.includes("share"))).toBe(false);+ // Hue ranks attention here, so the equal-weight series palette stays out.+ expect(fills.some((f) => f.includes("series"))).toBe(false);});it("breaks a count tie deterministically", () => {diff --git a/packages/ui/__tests__/shared/proportion-bar.test.tsx b/packages/ui/__tests__/shared/proportion-bar.test.tsxindex 8eab61b3e..968f5f302 100644--- a/packages/ui/__tests__/shared/proportion-bar.test.tsx+++ b/packages/ui/__tests__/shared/proportion-bar.test.tsx@@ -1,7 +1,8 @@import { describe, it, expect, vi } from "vitest";import { render, screen, fireEvent, within } from "@testing-library/react";-import { ProportionBar, shareColor, SHARE_TAIL } from "../../src/shared/proportion-bar";+import { ProportionBar, shareColor } from "../../src/shared/proportion-bar";+import { SERIES_TAIL, commitCategoryColor, seriesColor } from "../../src/shared/series";const seg = (key: string, value: number) => ({ key, label: key, value });@@ -15,15 +16,15 @@ function fills(container: HTMLElement) {}describe("ProportionBar", () => {- it("orders largest first and steps down the share palette", () => {+ it("orders largest first and takes the series colours in order", () => {const { container } = render(<ProportionBar label="Split" segments={[seg("b", 10), seg("a", 60), seg("c", 30)]} />,);expect(legendItems("Split").map((li) => li.textContent)).toEqual(["a60%", "c30%", "b10%"]);const styles = fills(container);- expect(styles[0]).toContain("--color-share-1");- expect(styles[1]).toContain("--color-share-2");- expect(styles[2]).toContain("--color-share-3");+ expect(styles[0]).toContain("--color-series-1");+ expect(styles[1]).toContain("--color-series-2");+ expect(styles[2]).toContain("--color-series-3");});it("folds the long tail into one named tail segment", () => {@@ -100,6 +101,43 @@ describe("ProportionBar", () => {/>,);expect(legendItems("Split").map((li) => li.textContent)).toEqual(["a20%", "Others80%"]);- expect(shareColor(5)).toBe(SHARE_TAIL);+ expect(shareColor(5)).toBe(SERIES_TAIL);+ });++ it("colours a named category the same on every chart", () => {+ render(+ <ProportionBar+ label="Commits"+ segments={[+ { key: "feature", label: "Feature", value: 10, color: commitCategoryColor("feature") },+ { key: "fix", label: "Fix", value: 90, color: commitCategoryColor("fix") },+ ]}+ />,+ );+ const swatches = legendItems("Commits").map(+ (li) => (li.querySelector("span[aria-hidden]") as HTMLElement).style.background,+ );+ // Sorted largest first, but each keeps its own colour.+ expect(swatches).toEqual(["var(--color-series-1)", "var(--color-series-2)"]);+ });+});++describe("series palette", () => {+ it("wraps past the last colour", () => {+ expect(seriesColor(0)).toBe("var(--color-series-1)");+ expect(seriesColor(7)).toBe("var(--color-series-8)");+ expect(seriesColor(8)).toBe("var(--color-series-1)");+ expect(seriesColor(-1)).toBe("var(--color-series-8)");+ });++ it("maps each commit category to one fixed colour", () => {+ expect(commitCategoryColor("fix")).toBe("var(--color-series-1)");+ expect(commitCategoryColor("feature")).toBe("var(--color-series-2)");+ expect(commitCategoryColor("refactor")).toBe("var(--color-series-3)");+ expect(commitCategoryColor("Docs")).toBe("var(--color-series-4)");+ expect(commitCategoryColor("test")).toBe("var(--color-series-5)");+ expect(commitCategoryColor("deps")).toBe(commitCategoryColor("dependency"));+ expect(commitCategoryColor("chore")).toBe("var(--color-series-8)");+ expect(commitCategoryColor("other")).toBe(SERIES_TAIL);});});diff --git a/packages/ui/scripts/contrast-check.py b/packages/ui/scripts/contrast-check.pyindex 77b383700..2a0479969 100755--- a/packages/ui/scripts/contrast-check.py+++ b/packages/ui/scripts/contrast-check.py@@ -117,7 +117,7 @@ LIGHT = {"success": "#1D8155","warning": "#856700","error": "#B23A2E",- "info": "#58436C",+ "info": "#3F6EA5",# Blueprint diagram ink (light) — KG canvas + mermaid."diagram-node-fill": "#241B2C","diagram-node-fill-2": "#4A4152",@@ -138,14 +138,15 @@ LIGHT = {"community-4": "#6B7A3D", "community-5": "#B06A86", "community-6": "#4A5D7A","community-7": "#A8821F", "community-8": "#8A7A66", "community-9": "#7A2F4A","community-10": "#B85A38", "community-11": "#2F6B66", "community-12": "#5E5360",- # Share steps (light): --color-text-primary mixed into --color-bg-inset at- # 86/74/63/54/47%. The tail (20%) is exempt: it is always named.- "share-1": "#413846", "share-2": "#59515C", "share-3": "#6F6871",- "share-4": "#827B82", "share-5": "#90898F",- # Heat steps (light): --color-text-primary mixed into --color-bg-surface- # at 6/14/26/62/82%.- "heat-1": "#F2F1F2", "heat-2": "#E0DFE1", "heat-3": "#C6C4C8",- "heat-4": "#77727C", "heat-5": "#4B4452",+ # Series (light): the community 1, 2, info, 4, 5, 7, 3 and 6 values.+ # The share tail is exempt: it is always named.+ "series-1": "#C0641A", "series-2": "#58436C", "series-3": "#3F6EA5",+ "series-4": "#6B7A3D", "series-5": "#B06A86", "series-6": "#A8821F",+ "series-7": "#B23A2E", "series-8": "#4A5D7A",+ # Heat steps (light): --color-accent-primary mixed into --color-bg-surface+ # at 10/26/50%, then accent-primary and accent-hover.+ "heat-1": "#F6EFE8", "heat-2": "#E7D6C2", "heat-3": "#D0B08A",+ "heat-4": "#A16215", "heat-5": "#824F10",}DARK = {@@ -167,7 +168,7 @@ DARK = {"success": "#34D399","warning": "#E8B339","error": "#E06A5A",- "info": "#A98FC4",+ "info": "#7DA7D9",# Blueprint diagram ink (dark) — border carries canvas separation."diagram-node-fill": "#322A3E","diagram-node-fill-2": "#261F30",@@ -187,12 +188,14 @@ DARK = {"community-4": "#A9BB6F", "community-5": "#D795B1", "community-6": "#8FA3C0","community-7": "#D9B04A", "community-8": "#B8A68E", "community-9": "#C4708F","community-10": "#EBA585", "community-11": "#6FB3AB", "community-12": "#A79DB3",- # Share steps (dark): 86/71/58/48/40%; tail (18%) exempt.- "share-1": "#D2D2D3", "share-2": "#AFAFB0", "share-3": "#919192",- "share-4": "#79797A", "share-5": "#676768",- # Heat steps (dark): the same mixes over the dark card.- "heat-1": "#212123", "heat-2": "#333335", "heat-3": "#4E4E4F",- "heat-4": "#9E9E9F", "heat-5": "#CACACB",+ # Series (dark): the same hues' dark values.+ "series-1": "#F59520", "series-2": "#A98FC4", "series-3": "#7DA7D9",+ "series-4": "#A9BB6F", "series-5": "#D795B1", "series-6": "#D9B04A",+ "series-7": "#E06A5A", "series-8": "#8FA3C0",+ # Heat steps (dark): --color-accent-primary mixed into the dark card at+ # 12/26/42/75%, then accent-primary.+ "heat-1": "#2F2317", "heat-2": "#4E3619", "heat-3": "#724A1A",+ "heat-4": "#BD751E", "heat-5": "#F59520",}# (fg, bg, floor, label) — floor is the WCAG ratio the pair must meet.@@ -231,10 +234,10 @@ CHECKS = [(f"community-{n}", "bg-canvas", 3.0, f"Community {n} hub on canvas")for n in range(1, 13)],- # Share-bar segments and legend swatches are non-text UI on page and card.+ # Chart series (bars, wedges, legend swatches) are non-text UI on page and card.*[- (f"share-{n}", bg, 3.0, f"Share step {n} on {where}")- for n in range(1, 6)+ (f"series-{n}", bg, 3.0, f"Series {n} on {where}")+ for n in range(1, 9)for bg, where in (("bg-root", "page"), ("bg-surface", "card"))],# Heatmap cells print their value: ink on the light steps, card colour on the dark.diff --git a/packages/ui/src/chat/view-part.tsx b/packages/ui/src/chat/view-part.tsxindex f73e5468f..9f2f1f416 100644--- a/packages/ui/src/chat/view-part.tsx+++ b/packages/ui/src/chat/view-part.tsx@@ -45,48 +45,32 @@ import {} from "@repowise-dev/types/views";import { BasisNote, RefView, refLabel, type RefHref } from "../cards/evidence-card";import { cn } from "../lib/cn";+import { SERIES, SERIES_TAIL, seriesColor } from "../shared/series";/**- * Series fills in fixed order, never cycled: the share steps, ink stepped- * toward the well, each clearing 3:1 on the page and a card. No hue, so a- * series never reads as navigation, model work or a health verdict. Only- * five clear the floor, so a chart plots its first five series and the- * legend points to the data table for the rest.+ * Series take the shared series palette in order. Lines also differ by dash+ * and scatter series by marker, one pattern each, so a chart plots its first+ * five series and the legend points to the data table for the rest.*/-const SERIES_FILLS = [- "var(--color-share-1)",- "var(--color-share-2)",- "var(--color-share-3)",- "var(--color-share-4)",- "var(--color-share-5)",-] as const;-/** Lines differ by dash as well as lightness, one pattern per fill. */const LINE_DASHES = ["", "6 3", "2 3", "8 3 2 3", "1 2"] as const;/** Scatter series differ by marker shape the same way. */const POINT_SHAPES: readonly SymbolType[] = ["circle", "square", "triangle", "diamond", "cross"];-const seriesFill = (i: number): string => SERIES_FILLS[Math.min(i, SERIES_FILLS.length - 1)]!;const lineDash = (i: number): string => LINE_DASHES[Math.min(i, LINE_DASHES.length - 1)]!;const pointShape = (i: number): SymbolType => POINT_SHAPES[Math.min(i, POINT_SHAPES.length - 1)]!;/** The series a chart draws; the rest stay in its data table. */-const drawnSeries = (view: ChartView): string[] => view.series.slice(0, SERIES_FILLS.length);+const drawnSeries = (view: ChartView): string[] => view.series.slice(0, LINE_DASHES.length);/**- * A donut's parts: the five share steps, then two neutral steps and the- * tail, which sit last where an Other part goes. Past five the steps no- * longer clear 3:1, so every part is also named with its value in the legend.+ * A donut's parts and a treemap's categories: one series colour each, then+ * the grey tail past the last colour, so no two named parts share a fill.+ * Every part is also named in the legend.*/-const DONUT_FILLS = [- ...SERIES_FILLS,- "var(--color-neutral-1)",- "var(--color-neutral-2)",- "var(--color-share-tail)",-] as const;-const donutFill = (i: number): string => DONUT_FILLS[Math.min(i, DONUT_FILLS.length - 1)]!;+const partFill = (i: number): string => (i < SERIES.length ? seriesColor(i) : SERIES_TAIL);/**- * Heatmap steps, light to dark (the heat tokens). The two dark steps carry- * card-coloured text and the light ones ink, each pair clearing 4.5:1, so a- * value reads on its cell.+ * Heatmap steps, light to dark (the heat tokens, an accent ramp). The two+ * deep steps carry card-coloured text and the light ones ink, each pair+ * clearing 4.5:1, so a value reads on its cell.*/const HEAT_STEPS = [{ fill: "var(--color-heat-1)", ink: false },@@ -220,7 +204,7 @@ export function ViewTable({</thead><tbody>{data.rows.map((row, i) => (- <tr key={i} className="border-b border-[var(--color-border-default)] last:border-0 print:break-inside-avoid">+ <tr key={i} className="border-b border-[var(--color-table-divider)] last:border-0 print:break-inside-avoid">{data.columns.map((column) => {const cell = row[column.key] ?? null;return (@@ -284,7 +268,7 @@ function legendItems(view: ChartView): Array<{ label: string; fill: string; valuconst labels = axisLabels(view.data.rows.map((row) => row[view.x] ?? null));return view.data.rows.map((row, i) => ({label: labels[i]!,- fill: donutFill(i),+ fill: partFill(i),value: row[key] ?? null,}));}@@ -299,7 +283,7 @@ function legendItems(view: ChartView): Array<{ label: string; fill: string; valu}if (view.series.length < 2) return [];const labels = new Map(view.data.columns.map((c) => [c.key, c.label]));- return drawnSeries(view).map((key, i) => ({ label: labels.get(key) ?? key, fill: seriesFill(i) }));+ return drawnSeries(view).map((key, i) => ({ label: labels.get(key) ?? key, fill: seriesColor(i) }));}function ChartLegend({ view }: { view: ChartView }) {@@ -372,11 +356,13 @@ function ChartPlot({ view }: { view: ChartView }) {nameKey={X_KEY}innerRadius="55%"outerRadius="85%"- stroke="var(--color-bg-root)"+ // Gaps, not a stroke, so the seams show whatever the chart sits on.+ stroke="none"+ paddingAngle={1}isAnimationActive={false}>{rows.map((_, i) => (- <Cell key={i} fill={donutFill(i)} />+ <Cell key={i} fill={partFill(i)} />))}</Pie>{tooltip}@@ -417,7 +403,7 @@ function ChartPlot({ view }: { view: ChartView }) {key={key}name={labels.get(key) ?? key}data={points}- fill={seriesFill(i)}+ fill={seriesColor(i)}shape={pointShape(i)}isAnimationActive={false}/>@@ -442,10 +428,10 @@ function ChartPlot({ view }: { view: ChartView }) {key={key}type="monotone"dataKey={key}- stroke={seriesFill(i)}+ stroke={seriesColor(i)}strokeDasharray={lineDash(i)}strokeWidth={2}- fill={seriesFill(i)}+ fill={seriesColor(i)}fillOpacity={0.18}connectNulls={false}isAnimationActive={false}@@ -471,7 +457,7 @@ function ChartPlot({ view }: { view: ChartView }) {key={key}type="monotone"dataKey={key}- stroke={seriesFill(i)}+ stroke={seriesColor(i)}strokeDasharray={lineDash(i)}strokeWidth={2}dot={rows.length <= 24}@@ -502,8 +488,8 @@ function ChartPlot({ view }: { view: ChartView }) {<Barkey={key}dataKey={key}- fill={seriesFill(i)}- {...(stacked ? { stackId: "parts", stroke: "var(--color-bg-surface)", strokeWidth: 1 } : {})}+ fill={seriesColor(i)}+ {...(stacked ? { stackId: "parts" } : {})}maxBarSize={28}isAnimationActive={false}/>@@ -534,9 +520,8 @@ function ChartPlot({ view }: { view: ChartView }) {<Barkey={key}dataKey={key}- fill={seriesFill(i)}- // A surface-coloured seam keeps stacked segments apart beyond their lightness.- {...(stacked ? { stackId: "parts", stroke: "var(--color-bg-surface)", strokeWidth: 1 } : {})}+ fill={seriesColor(i)}+ {...(stacked ? { stackId: "parts" } : {})}maxBarSize={18}isAnimationActive={false}/>@@ -669,11 +654,11 @@ interface TreemapBranch {/*** Each row's colour and the legend for it: health bands (as names, or a 0 to- * 10 health score) take the health ramp; other text takes the share steps in- * order of first appearance; other numbers take the heat steps.+ * 10 health score) take the health ramp; other text takes the series colours+ * in order of first appearance; other numbers take the heat steps.*/function treemapColors(view: ChartView): { fills: string[]; legend: Array<{ label: string; fill: string }> } {- const plain = "var(--color-share-3)";+ const plain = seriesColor(0);const key = view.color;if (!key) return { fills: view.data.rows.map(() => plain), legend: [] };const cells = view.data.rows.map((row) => row[key] ?? null);@@ -702,10 +687,10 @@ function treemapColors(view: ChartView): { fills: string[]; legend: Array<{ labe};}const order = [...new Set(names.filter((n): n is string => n !== null))];- const fillOf = (n: string | null) => (n === null ? "var(--color-node-neutral)" : seriesFill(order.indexOf(n)));+ const fillOf = (n: string | null) => (n === null ? "var(--color-node-neutral)" : partFill(order.indexOf(n)));return {fills: names.map(fillOf),- legend: order.slice(0, SERIES_FILLS.length).map((n) => ({ label: n, fill: fillOf(n) })),+ legend: order.slice(0, SERIES.length).map((n) => ({ label: n, fill: fillOf(n) })),};}@@ -759,7 +744,7 @@ function TreemapPlot({ view }: { view: ChartView }) {<divkey={`g${i}`}data-treemap-group=""- className="absolute truncate border border-[var(--color-border-default)] px-1 text-[10px] leading-3 text-[var(--color-text-tertiary)]"+ className="absolute truncate px-1 text-[10px] leading-3 text-[var(--color-text-tertiary)]"style={box(node)}title={`${d.name}: ${node.value}`}>@@ -802,7 +787,8 @@ function PartFrame({data-view-kind={part.kind}data-view-id={part.id}{...(part.kind === "chart" ? { "data-chart-type": part.chart_type } : {})}- className="m-0 space-y-2 rounded-lg border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] p-3 print:break-inside-avoid print:border-0 print:p-0"+ // No card of its own: the part sits on the transcript like the prose around it.+ className="m-0 space-y-2 py-1 print:break-inside-avoid print:p-0"><figcaption className="space-y-0.5"><span className="block text-sm font-medium text-[var(--color-text-primary)]">{part.title}</span>diff --git a/packages/ui/src/commits/code-evolution-chart.tsx b/packages/ui/src/commits/code-evolution-chart.tsxindex 728d99672..a241ba2e3 100644--- a/packages/ui/src/commits/code-evolution-chart.tsx+++ b/packages/ui/src/commits/code-evolution-chart.tsx@@ -23,6 +23,7 @@ import {} from "../ui/tooltip";import { cn } from "../lib/cn";import { parseDate } from "../lib/format";+import { commitCategoryColor } from "../shared/series";/*** The repo's development "story arc" — a stacked-area timeline of how the@@ -42,29 +43,18 @@ interface CategoryMeta {// Drawn bottom-to-top in STACK_ORDER; "feature" anchors the base so the growth// band reads as the foundation the rest of the work sits on.//-// No hue per category. This used to paint Feature in --color-success and-// Fix in --color-error, which reads intuitively for about a second and then-// costs more than it gives: those two tokens carry a health band on every-// other surface in the app, so a reader arriving from Code Health has been-// trained that green means good and red means bad. Here they mean "new-// capability" and "bug fix", and a quarter of commits being fixes is not-// thereby bad. Seven hues on the largest graphic on the page also set the-// ceiling for everything under it, leaving the review-priority pills in the-// table competing with the chart instead of leading.-//-// A share over time, so it takes the share steps like every other proportion:-// no hue. Fix gets the strongest step because it is the series this chart-// exists to show; the rest step down in rough order of interest, and the-// unclassified remainder sits on the well.+// Each category takes its fixed series colour (commitCategoryColor), the same+// on every chart that shows commit types. Not the health green and red: those+// carry a verdict elsewhere, and a quarter of commits being fixes is not bad.const CATEGORY_META: Record<CommitCategory, CategoryMeta> = {- feature: { label: "Feature", color: "var(--color-share-2)", blurb: "new capability" },- fix: { label: "Fix", color: "var(--color-share-1)", blurb: "bug / regression" },- refactor: { label: "Refactor", color: "var(--color-share-3)", blurb: "reshape / perf" },- docs: { label: "Docs", color: "var(--color-share-4)", blurb: "documentation" },- test: { label: "Test", color: "var(--color-share-5)", blurb: "tests / coverage" },- deps: { label: "Deps", color: "var(--color-share-tail)", blurb: "dependency bumps" },- chore: { label: "Chore", color: "var(--color-share-tail)", blurb: "tooling / CI / release" },- other: { label: "Other", color: "var(--color-bg-inset)", blurb: "unclassified" },+ feature: { label: "Feature", color: commitCategoryColor("feature"), blurb: "new capability" },+ fix: { label: "Fix", color: commitCategoryColor("fix"), blurb: "bug / regression" },+ refactor: { label: "Refactor", color: commitCategoryColor("refactor"), blurb: "reshape / perf" },+ docs: { label: "Docs", color: commitCategoryColor("docs"), blurb: "documentation" },+ test: { label: "Test", color: commitCategoryColor("test"), blurb: "tests / coverage" },+ deps: { label: "Deps", color: commitCategoryColor("deps"), blurb: "dependency bumps" },+ chore: { label: "Chore", color: commitCategoryColor("chore"), blurb: "tooling / CI / release" },+ other: { label: "Other", color: commitCategoryColor("other"), blurb: "unclassified" },};const STACK_ORDER: CommitCategory[] = [diff --git a/packages/ui/src/costs/daily-spend-chart.tsx b/packages/ui/src/costs/daily-spend-chart.tsxindex 80747c9a0..c237c8b9d 100644--- a/packages/ui/src/costs/daily-spend-chart.tsx+++ b/packages/ui/src/costs/daily-spend-chart.tsx@@ -3,6 +3,7 @@import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer } from "recharts";import { CHART_HEIGHT } from "./chart-height";import { formatCost } from "../lib/format";+import { seriesColor } from "../shared/series";export interface DailySpendChartProps {/** Day-grouped cost rows ({ group: "YYYY-MM-DD", cost_usd }). Caller fetches. */@@ -68,7 +69,7 @@ export function DailySpendChart({ groups, height = CHART_HEIGHT }: DailySpendChaformatter={(value) => [formatCost(Number(value)), "Cost"]}labelFormatter={(label) => `Date: ${String(label)}`}/>- <Bar dataKey="cost_usd" fill="var(--color-accent-primary)" radius={[4, 4, 0, 0]} />+ <Bar dataKey="cost_usd" fill={seriesColor(0)} radius={[4, 4, 0, 0]} /></BarChart></ResponsiveContainer></div>diff --git a/packages/ui/src/costs/operation-breakdown.tsx b/packages/ui/src/costs/operation-breakdown.tsxindex 7eb199637..7c6827052 100644--- a/packages/ui/src/costs/operation-breakdown.tsx+++ b/packages/ui/src/costs/operation-breakdown.tsx@@ -3,6 +3,7 @@import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, Cell } from "recharts";import { operationBreakdownHeight } from "./chart-height";import { formatCost } from "../lib/format";+import { seriesColor } from "../shared/series";export interface OperationBreakdownProps {groups: Array<{@@ -18,17 +19,6 @@ export interface OperationBreakdownProps {metric?: "cost_usd" | "calls" | "input_tokens" | "output_tokens";}-const PALETTE = [- "var(--color-accent-primary)",- "var(--color-lang-python)",- "var(--color-lang-typescript)",- "var(--color-lang-go)",- "var(--color-lang-rust)",- "var(--color-lang-java)",- "var(--color-lang-cpp)",- "var(--color-lang-other)",-];-export function OperationBreakdown({ groups, metric = "cost_usd" }: OperationBreakdownProps) {const sorted = [...groups].sort((a, b) => (b[metric] ?? 0) - (a[metric] ?? 0)).slice(0, 12);if (sorted.length === 0) {@@ -88,7 +78,7 @@ export function OperationBreakdown({ groups, metric = "cost_usd" }: OperationBre/><Bar dataKey={metric} radius={[0, 4, 4, 0]}>{sorted.map((row, i) => (- <Cell key={row.group} fill={PALETTE[i % PALETTE.length] ?? "var(--color-accent-primary)"} />+ <Cell key={row.group} fill={seriesColor(i)} />))}</Bar></BarChart>diff --git a/packages/ui/src/dashboard/kpi-strip.tsx b/packages/ui/src/dashboard/kpi-strip.tsxindex 8141a88d5..1654af44d 100644--- a/packages/ui/src/dashboard/kpi-strip.tsx+++ b/packages/ui/src/dashboard/kpi-strip.tsx@@ -41,7 +41,7 @@ function Gauge({ value }: { value: number }) {return (<div className="h-1.5 w-full overflow-hidden rounded-full bg-[var(--color-bg-inset)]"><div- className="h-full rounded-full bg-[var(--color-share-1)]"+ className="h-full rounded-full bg-[var(--color-series-1)]"style={{ width: `${clamped}%` }}/></div>diff --git a/packages/ui/src/dashboard/language-donut.tsx b/packages/ui/src/dashboard/language-donut.tsxindex 953f9041e..de7d420c9 100644--- a/packages/ui/src/dashboard/language-donut.tsx+++ b/packages/ui/src/dashboard/language-donut.tsx@@ -3,23 +3,15 @@import { PieChart, Pie, Cell, ResponsiveContainer, Tooltip } from "recharts";import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";import { Code } from "lucide-react";+import { SERIES_TAIL, seriesColor } from "../shared/series";-const LANG_COLORS: Record<string, string> = {- python: "var(--color-lang-python)",- typescript: "var(--color-lang-typescript)",- javascript: "var(--color-lang-typescript)",- go: "var(--color-lang-go)",- rust: "var(--color-lang-rust)",- java: "var(--color-lang-java)",- cpp: "var(--color-lang-cpp)",- c: "var(--color-lang-cpp)",- config: "var(--color-lang-config)",-};+const MAX_NAMED = 6;const HIDDEN_LANGUAGE_USAGE_FORMATS = new Set(["json", "yaml", "toml"]);-function getLangColor(lang: string): string {- return LANG_COLORS[lang.toLowerCase()] ?? "var(--color-lang-other)";+/** Largest language first in the series colours; the folded rest in grey. */+function langFill(rank: number): string {+ return rank < MAX_NAMED ? seriesColor(rank) : SERIES_TAIL;}function shouldShowLanguageUsage(name: string): boolean {@@ -42,8 +34,8 @@ export function LanguageDonut({ distribution, viewAllHref }: LanguageDonutProps)const total = entries.reduce((s, e) => s + e.value, 0);if (total === 0) return null;- const shown = entries.slice(0, 6);- const otherValue = entries.slice(6).reduce((s, e) => s + e.value, 0);+ const shown = entries.slice(0, MAX_NAMED);+ const otherValue = entries.slice(MAX_NAMED).reduce((s, e) => s + e.value, 0);if (otherValue > 0) shown.push({ name: "other", value: otherValue });return (@@ -79,8 +71,8 @@ export function LanguageDonut({ distribution, viewAllHref }: LanguageDonutProps)dataKey="value"stroke="none">- {shown.map((entry) => (- <Cell key={entry.name} fill={getLangColor(entry.name)} />+ {shown.map((entry, i) => (+ <Cell key={entry.name} fill={langFill(i)} />))}</Pie><Tooltip@@ -100,12 +92,12 @@ export function LanguageDonut({ distribution, viewAllHref }: LanguageDonutProps)</ResponsiveContainer></div><div className="space-y-1.5 min-w-0 flex-1">- {shown.map((entry) => (+ {shown.map((entry, i) => (<div key={entry.name} className="flex items-center justify-between text-xs"><div className="flex items-center gap-1.5 min-w-0"><spanclassName="h-2 w-2 rounded-full shrink-0"- style={{ backgroundColor: getLangColor(entry.name) }}+ style={{ backgroundColor: langFill(i) }}/><span className="text-[var(--color-text-secondary)] capitalize truncate">{entry.name}diff --git a/packages/ui/src/dashboard/overview-grid.tsx b/packages/ui/src/dashboard/overview-grid.tsxindex 2595c0e30..183d18ff1 100644--- a/packages/ui/src/dashboard/overview-grid.tsx+++ b/packages/ui/src/dashboard/overview-grid.tsx@@ -1,5 +1,6 @@import * as React from "react";import { Card, CardContent, CardHeader, CardTitle } from "../ui/card";+import { commitCategoryColor } from "../shared/series";/*** The Overview's primary two-column arrangement: a wide main column (health,@@ -43,28 +44,28 @@ export function CommitActivityCard({<span className="flex items-center gap-1"><spanclassName="inline-block h-2 w-2 rounded-sm"- style={{ background: "var(--color-info)" }}+ style={{ background: commitCategoryColor("feature") }}/>{" "}Feature</span><span className="flex items-center gap-1"><spanclassName="inline-block h-2 w-2 rounded-sm"- style={{ background: "var(--color-error)" }}+ style={{ background: commitCategoryColor("fix") }}/>{" "}Fix</span><span className="flex items-center gap-1"><spanclassName="inline-block h-2 w-2 rounded-sm"- style={{ background: "var(--color-accent-secondary)" }}+ style={{ background: commitCategoryColor("refactor") }}/>{" "}Refactor</span><span className="flex items-center gap-1"><spanclassName="inline-block h-2 w-2 rounded-sm"- style={{ background: "var(--color-accent-fill)" }}+ style={{ background: commitCategoryColor("dependency") }}/>{" "}Dependency</span>diff --git a/packages/ui/src/git/commit-category-donut.tsx b/packages/ui/src/git/commit-category-donut.tsxindex 0f5219a1d..dc78d45eb 100644--- a/packages/ui/src/git/commit-category-donut.tsx+++ b/packages/ui/src/git/commit-category-donut.tsx@@ -3,18 +3,12 @@import { PieChart as PieChartIcon } from "lucide-react";import { PieChart, Pie, Cell, Tooltip, ResponsiveContainer } from "recharts";import { EmptyState } from "../shared/empty-state";+import { commitCategoryColor } from "../shared/series";interface CommitCategoryDonutProps {categories: Record<string, number>;}-const CATEGORY_COLORS: Record<string, string> = {- feature: "var(--color-info)",- fix: "var(--color-error)",- refactor: "var(--color-accent-secondary)",- dependency: "var(--color-accent-fill)",-};-const CATEGORY_ORDER = ["feature", "fix", "refactor", "dependency"];export function CommitCategoryDonut({ categories }: CommitCategoryDonutProps) {@@ -55,7 +49,7 @@ export function CommitCategoryDonut({ categories }: CommitCategoryDonutProps) {{data.map((entry) => (<Cellkey={entry.key}- fill={CATEGORY_COLORS[entry.key] || "var(--color-accent-secondary)"}+ fill={commitCategoryColor(entry.key)}strokeWidth={0}/>))}diff --git a/packages/ui/src/git/commit-category-sparkline.tsx b/packages/ui/src/git/commit-category-sparkline.tsxindex 248030d37..e8b390f8f 100644--- a/packages/ui/src/git/commit-category-sparkline.tsx+++ b/packages/ui/src/git/commit-category-sparkline.tsx@@ -1,4 +1,5 @@import { ProportionBar } from "../shared/proportion-bar";+import { commitCategoryColor } from "../shared/series";interface CommitCategorySparklineProps {categories: Record<string, number>;@@ -11,7 +12,7 @@ const CATEGORY_LABEL: Record<string, string> = {dependency: "Dependency",};-/** A file's commits by type, on the shared share bar. */+/** A file's commits by type, on the shared share bar, each type in its own colour. */export function CommitCategorySparkline({ categories }: CommitCategorySparklineProps) {return (<ProportionBar@@ -21,6 +22,7 @@ export function CommitCategorySparkline({ categories }: CommitCategorySparklinePkey,label,value: categories[key] || 0,+ color: commitCategoryColor(key),}))}/>);diff --git a/packages/ui/src/git/contributor-bar.tsx b/packages/ui/src/git/contributor-bar.tsxindex e6c099f15..1c240c7bc 100644--- a/packages/ui/src/git/contributor-bar.tsx+++ b/packages/ui/src/git/contributor-bar.tsx@@ -8,6 +8,7 @@ import {Tooltip,ResponsiveContainer,} from "recharts";+import { seriesColor } from "../shared/series";interface ContributorBarProps {owners: Array<{ name: string; email?: string; file_count: number; pct: number }>;@@ -48,7 +49,7 @@ export function ContributorBar({ owners }: ContributorBarProps) {}}formatter={(value) => [typeof value === "number" ? value : 0, "files"]}/>- <Bar dataKey="files" fill="var(--color-accent-primary)" radius={[0, 4, 4, 0]} />+ <Bar dataKey="files" fill={seriesColor(0)} radius={[0, 4, 4, 0]} /></BarChart></ResponsiveContainer>);diff --git a/packages/ui/src/git/contributor-network.tsx b/packages/ui/src/git/contributor-network.tsxindex efb9dae70..a0cd124e3 100644--- a/packages/ui/src/git/contributor-network.tsx+++ b/packages/ui/src/git/contributor-network.tsx@@ -3,6 +3,7 @@import { useRef, useEffect, useMemo } from "react";import * as d3 from "d3-force";import type { Hotspot } from "@repowise-dev/types/git";+import { seriesColor } from "../shared/series";interface ContributorNetworkProps {hotspots: Hotspot[];@@ -18,15 +19,6 @@ interface ContributorLink extends d3.SimulationLinkDatum<ContributorNode> {sharedFiles: number;}-// Categorical contributor palette — token-driven so it themes (SVG fill-// accepts var()). 12 distinct warm-palette hues; mirrors the viz tokens.-const PALETTE = [- "var(--color-accent-fill)", "var(--color-accent-secondary)", "var(--color-success)",- "var(--color-warning)", "var(--color-info)", "var(--color-edge-co-change)",- "var(--color-edge-implements)", "var(--color-plum-400)", "var(--color-sunset-300)",- "var(--color-edge-inherits)", "var(--color-plum-300)", "var(--color-amber)",-];-const PALETTE_FALLBACK = "var(--color-accent-secondary)";export function ContributorNetwork({ hotspots }: ContributorNetworkProps) {const svgRef = useRef<SVGSVGElement>(null);@@ -110,7 +102,7 @@ export function ContributorNetwork({ hotspots }: ContributorNetworkProps) {const group = document.createElementNS(ns, "g");group.style.cursor = "pointer";- const fill = PALETTE[i % PALETTE.length] ?? PALETTE_FALLBACK;+ const fill = seriesColor(i);const circle = document.createElementNS(ns, "circle");circle.setAttribute("r", String(n.radius));circle.setAttribute("fill", fill);diff --git a/packages/ui/src/lib/confidence.ts b/packages/ui/src/lib/confidence.tsindex 2890d33e0..66529e329 100644--- a/packages/ui/src/lib/confidence.ts+++ b/packages/ui/src/lib/confidence.ts@@ -68,8 +68,8 @@ export function statusLabel(status: FreshnessStatus): string {/** ALLOWLISTED raw hex (no-raw-hex gate): LANGUAGE_COLORS are canonical* language brand colors and EDGE_COLORS feed <canvas>/SVG viz where a CSS- * var() string cannot resolve — both must be literal hex. Values mirror the- * --color-lang-* / --color-edge-* tokens in styles/globals.css; keep in sync.+ * var() string cannot resolve — both must be literal hex. EDGE_COLORS mirror+ * the --color-edge-* tokens in styles/globals.css; keep in sync.* Theme-aware canvas tinting (resolving these from CSS vars at runtime) is* tracked as follow-up viz work.*/diff --git a/packages/ui/src/overview/language-bar.tsx b/packages/ui/src/overview/language-bar.tsxindex 1ccf8af8e..b91ba6992 100644--- a/packages/ui/src/overview/language-bar.tsx+++ b/packages/ui/src/overview/language-bar.tsx@@ -4,9 +4,8 @@ import { ProportionBar } from "../shared/proportion-bar";/*** Language mix as a share bar plus a key.*- * Languages are named in the key, so they take the share steps like every- * other proportion rather than a hue each: a colour per language is only worth- * its cost with a fixed legend the reader learns once, and there is none.+ * Languages are named in the key, so they take the share steps (the series+ * colours by rank) like every other proportion.*/export function LanguageBar({distribution,diff --git a/packages/ui/src/owners/owner-profile.tsx b/packages/ui/src/owners/owner-profile.tsxindex 401191efb..82faac54d 100644--- a/packages/ui/src/owners/owner-profile.tsx+++ b/packages/ui/src/owners/owner-profile.tsx@@ -11,6 +11,7 @@ import { ReadsColumn, type ReadItem } from "../overview/reads-column";import { StatRibbon, type RibbonStat } from "../stats/stat-ribbon";import { EmptyState } from "../shared/empty-state";import { ProportionBar } from "../shared/proportion-bar";+import { commitCategoryColor } from "../shared/series";import { formatCompact, formatRelativeTimeOrNull } from "../lib/format";import { OwnerAvatar } from "./owner-avatar";@@ -254,8 +255,8 @@ export function OwnerProfileView({* reader to compare bars that are all measuring different denominators. One* bar shows the split, and the key carries the share.*- * The share steps, not a hue per directory: these are ordered shares of one- * whole, so position is the encoding.+ * The share steps, the series colours by rank: these are ordered shares of+ * one whole, so position is the encoding.*/function OwnershipFootprint({modules,@@ -543,8 +544,8 @@ function LeadPartner({* `perf`. The endpoint returns `feature`, `fix`, `refactor` and `dependency`,* so four of the five colours were unreachable and the largest category fell* through to the default — a palette that had never once rendered as designed.- * Ordered shares of one whole want the share steps, where position is the- * magnitude, not a hue per category.+ * Each category keeps its fixed colour (commitCategoryColor), the same as on+ * every other chart of commit types.** Zero-count categories are dropped rather than rendered as an empty track:* the endpoint returns the full key set, so a contributor who has never@@ -580,6 +581,7 @@ function CommitMix({ categories }: { categories: Record<string, number> }) {label: category.charAt(0).toUpperCase() + category.slice(1),value: n,detail: `${n.toLocaleString()} · ${pct(n, total)}%`,+ color: commitCategoryColor(category),}))}/>)}diff --git a/packages/ui/src/refactoring/opportunity.ts b/packages/ui/src/refactoring/opportunity.tsindex 3e37bbd63..c0b0c9937 100644--- a/packages/ui/src/refactoring/opportunity.ts+++ b/packages/ui/src/refactoring/opportunity.ts@@ -166,10 +166,9 @@ export function salienceOrder(marks: StructuralMark[]): string[] {/*** Two hues, then neutrals.*- * The accent/secondary pair, and deliberately not the `--color-share-*`- * steps: those are for shares of a whole, where position means magnitude, so- * spending them on unrelated categories would claim an order the types do not- * have. Type is carried in full+ * The accent/secondary pair, and deliberately not the full `--color-series-*`+ * palette: eight equal hues would give every type the same weight, and here+ * hue ranks attention. Type is carried in full* by the mark's shape, and named in the legend and the hover card, so hue here* only ranks attention - which is why the tail can recede into neutrals without* anything becoming unreadable.diff --git a/packages/ui/src/refactoring/structural-map.tsx b/packages/ui/src/refactoring/structural-map.tsxindex dfceb7b84..012f47d49 100644--- a/packages/ui/src/refactoring/structural-map.tsx+++ b/packages/ui/src/refactoring/structural-map.tsx@@ -34,8 +34,8 @@* six `--color-refactor-*` accents separating categories where two types were* 96% of the data, one of them the same green as the health badge beside it -* was against six hues over the whole plan list, and does not reach a two-hue- * pair over the four structural types. The `--color-share-*` steps- * stay out of it: globals.css reserves them for shares of a whole.+ * pair over the four structural types. The `--color-series-*` palette+ * stays out of it: eight equal hues would flatten the attention ranking.** Every mark also carries a separating stroke, which is what actually makes* it visible: the neutral tiers sit under 2.5:1 against the page in bothdiff --git a/packages/ui/src/savings/savings-timeline.tsx b/packages/ui/src/savings/savings-timeline.tsxindex 87c69461e..4b351f684 100644--- a/packages/ui/src/savings/savings-timeline.tsx+++ b/packages/ui/src/savings/savings-timeline.tsx@@ -5,6 +5,7 @@ import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer } from "rechaimport { formatTokens } from "../lib/format";import type { SavingsBreakdownRow } from "./types";+import { seriesColor } from "../shared/series";/** Below this many days with a recorded saving, a bar chart is two or three* bars in a wide empty box: the shape carries nothing a sentence does not.@@ -117,7 +118,7 @@ export function SavingsTimeline({ days, height = TIMELINE_HEIGHT }: SavingsTimelformatter={(value) => [`${formatTokens(Number(value))} tokens`, "Saved"]}labelFormatter={(label) => String(label)}/>- <Bar dataKey="tokens" fill="var(--color-accent-fill)" radius={[3, 3, 0, 0]} />+ <Bar dataKey="tokens" fill={seriesColor(0)} radius={[3, 3, 0, 0]} /></BarChart></ResponsiveContainer></div>diff --git a/packages/ui/src/shared/index.ts b/packages/ui/src/shared/index.tsindex 31a005166..c82e5f846 100644--- a/packages/ui/src/shared/index.ts+++ b/packages/ui/src/shared/index.ts@@ -91,8 +91,8 @@ export { resolveToken, resolveTokens, useThemeVersion } from "./use-theme-tokensexport {ProportionBar,SHARE_STEPS,- SHARE_TAIL,shareColor,type ProportionBarProps,type ProportionSegment,} from "./proportion-bar";+export { SERIES, SERIES_TAIL, seriesColor, commitCategoryColor } from "./series";diff --git a/packages/ui/src/shared/proportion-bar.tsx b/packages/ui/src/shared/proportion-bar.tsxindex e158d1258..7ee552e52 100644--- a/packages/ui/src/shared/proportion-bar.tsx+++ b/packages/ui/src/shared/proportion-bar.tsx@@ -1,24 +1,13 @@import * as React from "react";import { cn } from "../lib/cn";+import { SERIES, SERIES_TAIL } from "./series";-/**- * The share steps, largest share first. Literal strings so Tailwind's scan- * keeps the tokens; see `--color-share-*` in globals.css.- */-export const SHARE_STEPS = [- "var(--color-share-1)",- "var(--color-share-2)",- "var(--color-share-3)",- "var(--color-share-4)",- "var(--color-share-5)",-] as const;--/** The collapsed remainder: present, but not a step. */-export const SHARE_TAIL = "var(--color-share-tail)";+/** The share steps, largest share first: the first five series colours. */+export const SHARE_STEPS = SERIES.slice(0, 5);/** Fill for the segment at `rank` (0 = largest). Past the last step, the tail. */export function shareColor(rank: number): string {- return SHARE_STEPS[rank] ?? SHARE_TAIL;+ return SHARE_STEPS[rank] ?? SERIES_TAIL;}export interface ProportionSegment {@@ -28,8 +17,9 @@ export interface ProportionSegment {/** Legend figure. Defaults to the rounded share ("42%"). */detail?: string | undefined;/**- * Semantic fill, only for segments that are a verdict (health band,- * severity, freshness). Everything else takes the share steps.+ * Fixed fill, for segments that are a verdict (health band, severity,+ * freshness) or a named category (commit type) that keeps one colour+ * everywhere. Everything else takes the share steps by rank.*/color?: string | undefined;/** An unitemised remainder ("others"): drawn last, in the tail step. */@@ -109,7 +99,7 @@ function buildRows(return {rows: [...shown.map((s, i) => toRow(s, s.color ?? shareColor(i))),- ...tailSegments.map((s) => toRow(s, s.color ?? SHARE_TAIL)),+ ...tailSegments.map((s) => toRow(s, s.color ?? SERIES_TAIL)),],total,};@@ -119,9 +109,9 @@ function buildRows(* A share of a whole, as one bar and a legend.** Every proportion in the product goes through this, so they all read the- * same: ink steps from strongest to faintest, largest share first, hairline- * gaps between segments, the long tail folded into "N others". Hue is kept- * for bars whose segments are a verdict, which pass `color`.+ * same: the series colours in order, largest share first, hairline gaps+ * between segments, the long tail folded into "N others" in grey. Bars whose+ * segments are a verdict or a named category pass `color`.** With the legend on, the legend is the accessible reading (a labelled list)* and the bar is decoration; with it off, the bar carries the summary itself.diff --git a/packages/ui/src/shared/series.ts b/packages/ui/src/shared/series.tsnew file mode 100644index 000000000..8e87f2ae3--- /dev/null+++ b/packages/ui/src/shared/series.ts@@ -0,0 +1,44 @@+/**+ * The one categorical palette for every chart: `--color-series-*` in+ * globals.css. Literal strings so Tailwind's scan keeps the tokens.+ */+export const SERIES = [+ "var(--color-series-1)", // orange+ "var(--color-series-2)", // plum+ "var(--color-series-3)", // blue+ "var(--color-series-4)", // olive+ "var(--color-series-5)", // rose+ "var(--color-series-6)", // gold+ "var(--color-series-7)", // brick+ "var(--color-series-8)", // slate+] as const;++/** The grey for an unnamed remainder ("Other"): present, but not a series. */+export const SERIES_TAIL = "var(--color-share-tail)";++/** Fill for series `i`, wrapping past the last colour. */+export function seriesColor(i: number): string {+ const n = SERIES.length;+ return SERIES[((Math.trunc(i) % n) + n) % n]!;+}++/**+ * Commit categories keep one colour on every chart that shows them, so Fix+ * is the same orange on a donut, a share bar and the evolution chart.+ */+const COMMIT_CATEGORY_SERIES: Record<string, number> = {+ fix: 0,+ feature: 1,+ refactor: 2,+ docs: 3,+ test: 4,+ deps: 5,+ dependency: 5,+ chore: 7,+};++/** Fill for a commit category; unknown or "other" takes the tail grey. */+export function commitCategoryColor(category: string): string {+ const i = COMMIT_CATEGORY_SERIES[category.toLowerCase()];+ return i === undefined ? SERIES_TAIL : seriesColor(i);+}diff --git a/packages/ui/src/wiki/git-history-panel.tsx b/packages/ui/src/wiki/git-history-panel.tsxindex fbb186200..8115ccc1e 100644--- a/packages/ui/src/wiki/git-history-panel.tsx+++ b/packages/ui/src/wiki/git-history-panel.tsx@@ -189,8 +189,8 @@ export function GitHistoryPanel({ git }: GitHistoryPanelProps) {<div className="h-1 w-full rounded-full bg-[var(--color-bg-elevated)] ml-7"><divclassName="h-1 rounded-full transition-all"- // One share step for every row: the length is the reading.- style={{ width: `${share * 100}%`, backgroundColor: "var(--color-share-1)" }}+ // One series colour for every row: the length is the reading.+ style={{ width: `${share * 100}%`, backgroundColor: "var(--color-series-1)" }}/></div>)}diff --git a/packages/ui/styles/globals.css b/packages/ui/styles/globals.cssindex 995f534a8..11b2427d8 100644--- a/packages/ui/styles/globals.css+++ b/packages/ui/styles/globals.css@@ -119,31 +119,33 @@--color-model-hover: var(--color-plum-600);--color-model-muted: color-mix(in srgb, var(--color-accent-secondary) 14%, transparent);- /* Share steps — the one palette for a share-of-whole bar (ProportionBar):- ink stepped toward the well, largest share first, `tail` for the- collapsed rest. No hue, so a proportion never reads as navigation (orange),- model work (plum) or a health verdict (green/amber/red). Steps 1-5 clear- 3:1 against the page and a card in both themes; the tail does not and is- always named in the legend.-- Per theme because the same mix that holds on cream fades out on- near-black. */- --color-share-1: color-mix(in srgb, var(--color-text-primary) 86%, var(--color-bg-inset));- --color-share-2: color-mix(in srgb, var(--color-text-primary) 74%, var(--color-bg-inset));- --color-share-3: color-mix(in srgb, var(--color-text-primary) 63%, var(--color-bg-inset));- --color-share-4: color-mix(in srgb, var(--color-text-primary) 54%, var(--color-bg-inset));- --color-share-5: color-mix(in srgb, var(--color-text-primary) 47%, var(--color-bg-inset));+ /* Series — the one categorical palette for every chart (seriesColor in+ shared/series.ts): orange, plum, blue, olive, rose, gold, brick, slate,+ ordered so neighbours stay apart. The community hues' values, set here+ and in `.dark` so they theme in this layer; plum, blue and brick alias+ tokens with the same values in both themes. Each clears 3:1 on the page+ and a card in both themes (contrast-check.py). `share-tail` is the grey+ for an unnamed remainder ("Other"). Verdicts (health bands, risk) keep+ their own tokens. */+ --color-series-1: #c0641a;+ --color-series-2: var(--color-accent-secondary);+ --color-series-3: var(--color-info);+ --color-series-4: #6b7a3d;+ --color-series-5: #b06a86;+ --color-series-6: #a8821f;+ --color-series-7: var(--color-error);+ --color-series-8: #4a5d7a;--color-share-tail: color-mix(in srgb, var(--color-text-primary) 20%, var(--color-bg-inset));- /* Heat steps — a heatmap cell's fill, light to dark: ink stepped into the- card. Steps 1-3 carry ink text, 4-5 card-coloured text; each pairing- clears 4.5:1 in both themes (contrast-check.py). Per theme for the same- reason as the share steps. */- --color-heat-1: color-mix(in srgb, var(--color-text-primary) 6%, var(--color-bg-surface));- --color-heat-2: color-mix(in srgb, var(--color-text-primary) 14%, var(--color-bg-surface));- --color-heat-3: color-mix(in srgb, var(--color-text-primary) 26%, var(--color-bg-surface));- --color-heat-4: color-mix(in srgb, var(--color-text-primary) 62%, var(--color-bg-surface));- --color-heat-5: color-mix(in srgb, var(--color-text-primary) 82%, var(--color-bg-surface));- /* Supporting cast beside an accent series. Same idea, no hue. */+ /* Heat steps — a heatmap cell's fill, light to dark: the accent stepped+ into the card. Steps 1-3 carry ink text, 4-5 card-coloured text; each+ pairing clears 4.5:1 in both themes (contrast-check.py). Per theme+ because the light accent darkens and the dark one lightens. */+ --color-heat-1: color-mix(in srgb, var(--color-accent-primary) 10%, var(--color-bg-surface));+ --color-heat-2: color-mix(in srgb, var(--color-accent-primary) 26%, var(--color-bg-surface));+ --color-heat-3: color-mix(in srgb, var(--color-accent-primary) 50%, var(--color-bg-surface));+ --color-heat-4: var(--color-accent-primary);+ --color-heat-5: var(--color-accent-hover);+ /* Supporting cast beside an accent series: tertiary ink stepped into the well. */--color-neutral-1: color-mix(in srgb, var(--color-text-tertiary) 62%, var(--color-bg-inset));--color-neutral-2: color-mix(in srgb, var(--color-text-tertiary) 40%, var(--color-bg-inset));--color-neutral-3: color-mix(in srgb, var(--color-text-tertiary) 22%, var(--color-bg-inset));@@ -262,14 +264,7 @@--color-zoom-grid: rgba(36, 27, 44, 0.045);--color-zoom-grid-strong: rgba(36, 27, 44, 0.08);- /* Language colors (canonical brand hues — theme-independent) */- --color-lang-python: #3776ab;- --color-lang-typescript: #3178c6;- --color-lang-go: #00add8;- --color-lang-rust: #dea584;- --color-lang-java: #ed8b00;- --color-lang-cpp: #00599c;- --color-lang-config: #6b7280;+ /* The "Other" provider in the costs comparison (theme-independent). */--color-lang-other: #8b5cf6;/* Edge colors (graph edges) — remapped to the new palette */@@ -323,10 +318,9 @@--color-viz-diff-affected: var(--color-warning);/* Savings surfaces — two categorical hues distinguishing the distill ledger- from MCP-tool answers in the Costs savings card. Plum + brand-orange so the- split reads in both themes without a third brand color. */- --color-savings-distill: var(--color-accent-fill);- --color-savings-mcp: var(--color-accent-secondary);+ from MCP-tool answers in the Costs savings card: the first two series. */+ --color-savings-distill: var(--color-series-1);+ --color-savings-mcp: var(--color-series-2);/* ================================================================== *//* Signature gradients (theme-independent) */@@ -510,19 +504,18 @@and need no override; see the light block for the family. */--color-model-hover: var(--color-plum-200);- /* Share steps — see the light block. Light ink on near-black stays visible- lower down, so the steps spread wider before the 3:1 floor. */- --color-share-1: color-mix(in srgb, var(--color-text-primary) 86%, var(--color-bg-inset));- --color-share-2: color-mix(in srgb, var(--color-text-primary) 71%, var(--color-bg-inset));- --color-share-3: color-mix(in srgb, var(--color-text-primary) 58%, var(--color-bg-inset));- --color-share-4: color-mix(in srgb, var(--color-text-primary) 48%, var(--color-bg-inset));- --color-share-5: color-mix(in srgb, var(--color-text-primary) 40%, var(--color-bg-inset));+ /* Series, the tail and heat steps — see the light block. */+ --color-series-1: #f59520;+ --color-series-4: #a9bb6f;+ --color-series-5: #d795b1;+ --color-series-6: #d9b04a;+ --color-series-8: #8fa3c0;--color-share-tail: color-mix(in srgb, var(--color-text-primary) 18%, var(--color-bg-inset));- --color-heat-1: color-mix(in srgb, var(--color-text-primary) 6%, var(--color-bg-surface));- --color-heat-2: color-mix(in srgb, var(--color-text-primary) 14%, var(--color-bg-surface));- --color-heat-3: color-mix(in srgb, var(--color-text-primary) 26%, var(--color-bg-surface));- --color-heat-4: color-mix(in srgb, var(--color-text-primary) 62%, var(--color-bg-surface));- --color-heat-5: color-mix(in srgb, var(--color-text-primary) 82%, var(--color-bg-surface));+ --color-heat-1: color-mix(in srgb, var(--color-accent-primary) 12%, var(--color-bg-surface));+ --color-heat-2: color-mix(in srgb, var(--color-accent-primary) 26%, var(--color-bg-surface));+ --color-heat-3: color-mix(in srgb, var(--color-accent-primary) 42%, var(--color-bg-surface));+ --color-heat-4: color-mix(in srgb, var(--color-accent-primary) 75%, var(--color-bg-surface));+ --color-heat-5: var(--color-accent-primary);--color-neutral-1: color-mix(in srgb, var(--color-text-tertiary) 70%, var(--color-bg-inset));--color-neutral-2: color-mix(in srgb, var(--color-text-tertiary) 45%, var(--color-bg-inset));--color-neutral-3: color-mix(in srgb, var(--color-text-tertiary) 26%, var(--color-bg-inset));