feat(ui): map canvas follows light/dark theme; fix invisible gear control
Tests · UI / test (push) Waiting to run
Tests · UI / test (pull_request) Successful in 2m45s

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:
Ilia Denisov
2026-05-24 08:49:37 +02:00
parent d44ad9b6eb
commit f6e4a4f6bd
27 changed files with 631 additions and 230 deletions
+11 -9
View File
@@ -15,14 +15,7 @@
import type { GameReport, ReportPlanet } from "../api/game-state";
import type { OrderCommand } from "../sync/order-types";
import { torusShortestDelta } from "./math";
import type { LinePrim, PrimitiveID, Style } from "./world";
const STYLE_PENDING_SEND_LINE: Style = {
strokeColor: 0x66bb6a,
strokeAlpha: 0.85,
strokeWidthPx: 1,
strokeDashPx: 4,
};
import { DARK_THEME, type LinePrim, type PrimitiveID, type Style, type Theme } from "./world";
// Sit between cargo-route arrows (5..8) and ship-group points (5..)
// in priority. The line never participates in hit-test (hitSlopPx=0)
@@ -50,15 +43,24 @@ export const PENDING_SEND_LINE_ID_PREFIX = 0xa0000000;
* The function is pure — it walks the supplied arrays and returns
* a new primitive list. Callers combine the result with cargo-
* route lines and feed both into `handle.setExtraPrimitives`.
*
* `theme` supplies the dashed-line colour and defaults to `DARK_THEME`.
*/
export function buildPendingSendLines(
report: GameReport,
commands: readonly OrderCommand[],
statuses: Readonly<Record<string, string>>,
opts?: { skipPlanets?: ReadonlySet<number> },
theme: Theme = DARK_THEME,
): LinePrim[] {
if (commands.length === 0) return [];
const skip = opts?.skipPlanets;
const style: Style = {
strokeColor: theme.pendingSend,
strokeAlpha: 0.85,
strokeWidthPx: 1,
strokeDashPx: 4,
};
const planetById = new Map<number, ReportPlanet>();
for (const planet of report.planets) {
planetById.set(planet.number, planet);
@@ -93,7 +95,7 @@ export function buildPendingSendLines(
kind: "line",
id: pendingSendLineId(serial),
priority: PRIORITY_PENDING_SEND_LINE,
style: STYLE_PENDING_SEND_LINE,
style,
hitSlopPx: 0,
x1: source.x,
y1: source.y,