feat(ui): map canvas follows light/dark theme; fix invisible gear control
The map view now selects a DARK_THEME or LIGHT_THEME palette from the resolved app theme and threads it through every primitive builder, so the canvas, planets, ship groups, cargo routes, battle/bombing markers, fog, reach + selection rings, pending-Send tracks, and the pick overlay all switch with the rest of the chrome. A theme flip remounts the renderer preserving the camera — Pixi bakes the background at init and every primitive bakes its colour at build, so a live re-tint is not possible on the same instance. This also fixes the reported bug: the gear-popover trigger and the loading overlay hardcoded a dark navy background, so in light theme the gear was invisible (dark icon on dark chip) until hover flipped it to a white chip. Both now use the --color-surface-overlay token and read correctly in both themes. The light palette mirrors the dark one role-for-role, darkened / saturated for contrast on a light background while keeping the incoming, battle, and bombing accents vivid. The values are a first pass meant to be refined during the F8 manual-QA loop. Removes the now-dead "Phase 35" references from the code and lifts the map-recoloring prohibition from the design-system / renderer docs; the battle scene stays a fixed-palette data-viz surface. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -13,12 +13,9 @@ import type {
|
||||
} from "../src/api/game-state";
|
||||
import {
|
||||
ROUTE_LINE_ID_PREFIX,
|
||||
STYLE_ROUTE_CAP,
|
||||
STYLE_ROUTE_COL,
|
||||
STYLE_ROUTE_EMP,
|
||||
STYLE_ROUTE_MAT,
|
||||
buildCargoRouteLines,
|
||||
} from "../src/map/cargo-routes";
|
||||
import { DARK_THEME, LIGHT_THEME } from "../src/map/world";
|
||||
import { EMPTY_SHIP_GROUPS } from "./helpers/empty-ship-groups";
|
||||
|
||||
function makePlanet(overrides: Partial<ReportPlanet>): ReportPlanet {
|
||||
@@ -146,10 +143,25 @@ describe("buildCargoRouteLines", () => {
|
||||
if (existing === undefined) styleByPriority.set(line.priority, line.style);
|
||||
else expect(existing).toBe(line.style);
|
||||
}
|
||||
expect(styleByPriority.get(8)).toBe(STYLE_ROUTE_COL);
|
||||
expect(styleByPriority.get(7)).toBe(STYLE_ROUTE_CAP);
|
||||
expect(styleByPriority.get(6)).toBe(STYLE_ROUTE_MAT);
|
||||
expect(styleByPriority.get(5)).toBe(STYLE_ROUTE_EMP);
|
||||
// Default (dark) palette colours, one per load type.
|
||||
expect(styleByPriority.get(8)?.strokeColor).toBe(DARK_THEME.routeCol);
|
||||
expect(styleByPriority.get(7)?.strokeColor).toBe(DARK_THEME.routeCap);
|
||||
expect(styleByPriority.get(6)?.strokeColor).toBe(DARK_THEME.routeMat);
|
||||
expect(styleByPriority.get(5)?.strokeColor).toBe(DARK_THEME.routeEmp);
|
||||
});
|
||||
|
||||
test("uses the supplied palette's stroke colours", () => {
|
||||
const report = makeReport(
|
||||
[
|
||||
makePlanet({ number: 1, x: 100, y: 100 }),
|
||||
makePlanet({ number: 2, x: 200, y: 100 }),
|
||||
],
|
||||
1,
|
||||
[{ loadType: "COL", destinationPlanetNumber: 2 }],
|
||||
);
|
||||
const [shaft] = buildCargoRouteLines(report, undefined, LIGHT_THEME);
|
||||
expect(shaft.style.strokeColor).toBe(LIGHT_THEME.routeCol);
|
||||
expect(LIGHT_THEME.routeCol).not.toBe(DARK_THEME.routeCol);
|
||||
});
|
||||
|
||||
test("line ids carry the ROUTE_LINE_ID_PREFIX high bit", () => {
|
||||
|
||||
Reference in New Issue
Block a user