Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

theme the City's hardcoded scene surfaces to the active accent (Closes #908)

[._.]/ Adam Eivy8882e604d2e1
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 0a61240c37..ae933877fa 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -14,4 +14,5 @@
- **City follows your PortOS theme** — the HUD panels (now fully opaque for readability) and the 3D scene's accent surfaces (ground grid, particles, online buildings, neon, and the CRT edge-glow) recolor to the active theme instead of being locked to dark cyan-on-black. The CRT affectations are opt-in per theme family: scanlines only on the terminal family, neon edge-glow on terminal + classic, and a cinematic vignette on all but the clean glass family. Status colors (stopped/red, warnings/amber) stay semantic.
- **City time-of-day follows your theme (day/night), with a real daytime look** — the old four-way sunrise/noon/sunset/midnight picker is now Auto/Day/Night. Auto (the default) renders a bright daytime city under light themes and a dark neon city under dark themes; you can still force Day or Night. Daytime is now a genuine bright, sunlit style rather than dusk: the night-tuned color grade, bloom, film grain, and chromatic aberration fade out in daylight; the sky opens to a luminous blue with high-key sun + sky fill; the ground sheds its neon grid and wet-street glow; and buildings shed their neon (edge strips, halos, base glow) to read as light, sunlit solids. The dark neon night look is unchanged. Existing installs pick up the coupling automatically (any previously-saved time-of-day reads as Auto).
- **City labels stay readable in daytime** — in the daytime view, the in-world text labels (app and process names, plus every district readout — goals, health, task queue, memory, Jira, AI core, productivity, backup, federation mesh, voice, review/instance beacons, and the archive-district sign) no longer wash out against the bright sky. At night they keep their neon glow; as day comes up they switch to dark ink with a soft light halo so they read against sunlit buildings and the open sky. Decorative neon signage still dims in daylight, as it should. Works across all eight themes (four day, four night). No change to the night look.
+- **[issue-908] City scene theming goes deeper** — the parts of the 3D city that were still locked to the cyan-on-black cyberpunk palette now follow your theme too. Building bodies, the district/monument plinths and footings, the building window-grid bases, and the upper sky gradient all pick up a tint from the active theme accent (with their original darkness/brightness preserved, so the scene's depth and shading are unchanged — just recolored). Process buildings now use the same status colors as their parent app (a stopped process is the same red as a stopped app, not amber; a missing one the same purple, not indigo) and an online process follows the theme accent. Works across all eight themes.
- **[issue-875] CyberCity district layout internals consolidated** — the city's districts now share one set of layout primitives for grid placement, category tallies, and log-scaled building heights, so each district no longer carries its own copy of that math. No visible change to the city.
diff --git a/client/src/components/city/Building.jsx b/client/src/components/city/Building.jsx
index bccf9c54c6..51e39dbc3b 100644
--- a/client/src/components/city/Building.jsx
+++ b/client/src/components/city/Building.jsx
@@ -1,7 +1,7 @@
import { useRef, useState, useMemo } from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';
-import { getBuildingColor, getBuildingHeight, getAccentColor, CITY_COLORS, BUILDING_PARAMS, PIXEL_FONT_URL, mixHex } from './cityConstants';
+import { getBuildingColor, getBuildingHeight, getAccentColor, CITY_COLORS, BUILDING_PARAMS, PIXEL_FONT_URL, mixHex, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import HolographicPanel from './HolographicPanel';
import BuildingHologram from './BuildingHologram';
@@ -100,8 +100,8 @@ const createWindowTexture = (accentColor, width, height, seed) => {
canvas.height = px * rowCount;
const ctx = canvas.getContext('2d');
- // Dark base
- ctx.fillStyle = '#050510';
+ // Dark base (tinted toward the theme accent, luminance preserved)
+ ctx.fillStyle = tintStructure('#050510');
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Seeded random for consistent patterns
@@ -122,7 +122,7 @@ const createWindowTexture = (accentColor, width, height, seed) => {
} else if (bright > 0.3) {
ctx.fillStyle = accentColor + '20';
} else {
- ctx.fillStyle = '#0a0f1e';
+ ctx.fillStyle = tintStructure('#0a0f1e');
}
ctx.fillRect(c * px + 1, r * px + 1, px - 2, px - 2);
}
diff --git a/client/src/components/city/CityAiCore.jsx b/client/src/components/city/CityAiCore.jsx
index 480e3fd84d..03e2b5582c 100644
--- a/client/src/components/city/CityAiCore.jsx
+++ b/client/src/components/city/CityAiCore.jsx
@@ -1,7 +1,7 @@
import { useMemo, useRef } from 'react';
import * as THREE from 'three';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeAiCore, computeAiCoreBeams, AI_CORE } from '../../utils/cityAiCore';
@@ -107,7 +107,7 @@ export default function CityAiCore({ aiActivity, positions, apps, settings }) {
{/* Slender spire body — tapered so it reads as a tower, not a column */}
<mesh position={[0, height / 2, 0]}>
<cylinderGeometry args={[0.5, 1.4, height, 8]} />
- <meshStandardMaterial color="#0a0f1c" emissive={color} emissiveIntensity={0.1 + core.intensity * 0.15} metalness={0.7} roughness={0.4} />
+ <meshStandardMaterial color={tintStructure('#0a0f1c')} emissive={color} emissiveIntensity={0.1 + core.intensity * 0.15} metalness={0.7} roughness={0.4} />
</mesh>
{/* Apex orb — the live AI-activity indicator */}
<mesh ref={apexRef} position={[0, apexY, 0]}>
diff --git a/client/src/components/city/CityArtifacts.jsx b/client/src/components/city/CityArtifacts.jsx
index 5f537cd019..8d2b4ee3c6 100644
--- a/client/src/components/city/CityArtifacts.jsx
+++ b/client/src/components/city/CityArtifacts.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeArtifacts, ARTIFACTS } from '../../utils/cityArtifacts';
@@ -20,7 +20,7 @@ function Artifact({ artifact, dayMix = 0 }) {
{/* Pedestal base */}
<mesh position={[0, ph / 2, 0]}>
<cylinderGeometry args={[pw * 0.6, pw * 0.7, ph, 6]} />
- <meshStandardMaterial color="#0a0e16" emissive={color} emissiveIntensity={0.12} metalness={0.7} roughness={0.4} />
+ <meshStandardMaterial color={tintStructure('#0a0e16')} emissive={color} emissiveIntensity={0.12} metalness={0.7} roughness={0.4} />
</mesh>
{/* Glowing faceted emblem — the artifact itself */}
diff --git a/client/src/components/city/CityBackupVault.jsx b/client/src/components/city/CityBackupVault.jsx
index 5a91b5536c..6ec7cc926c 100644
--- a/client/src/components/city/CityBackupVault.jsx
+++ b/client/src/components/city/CityBackupVault.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeBackupVault } from '../../utils/cityBackupVault';
import { timeAgo } from '../../utils/formatters';
@@ -39,7 +39,7 @@ export default function CityBackupVault({ backupStatus, settings }) {
<mesh position={[0, height / 2, 0]}>
<boxGeometry args={[width, height, width * 0.8]} />
<meshStandardMaterial
- color="#0a0e16"
+ color={tintStructure('#0a0e16')}
emissive={color}
emissiveIntensity={0.12 + vault.intensity * 0.18}
metalness={0.6}
@@ -49,7 +49,7 @@ export default function CityBackupVault({ backupStatus, settings }) {
{/* Beveled cap so it reads as a sealed bunker, not just a box */}
<mesh position={[0, height + 0.25, 0]}>
<boxGeometry args={[width * 1.1, 0.5, width * 0.9]} />
- <meshStandardMaterial color="#0d131f" emissive={color} emissiveIntensity={0.25} metalness={0.7} roughness={0.4} />
+ <meshStandardMaterial color={tintStructure('#0d131f')} emissive={color} emissiveIntensity={0.25} metalness={0.7} roughness={0.4} />
</mesh>
{/* Circular vault seal on the front (+Z) face — the live health indicator */}
<mesh ref={sealRef} position={[0, height * 0.5, width * 0.4 + 0.05]} rotation={[Math.PI / 2, 0, 0]}>
diff --git a/client/src/components/city/CityFederationHorizon.jsx b/client/src/components/city/CityFederationHorizon.jsx
index cd7523d83f..3cf486f2a1 100644
--- a/client/src/components/city/CityFederationHorizon.jsx
+++ b/client/src/components/city/CityFederationHorizon.jsx
@@ -1,7 +1,7 @@
import { useMemo, useRef, useEffect } from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeFederationHorizon, FEDERATION } from '../../utils/cityFederation';
@@ -62,7 +62,7 @@ function Monolith({ position, width, height, color, opacity, label, sublabel, on
<mesh position={[0, height / 2, 0]}>
<boxGeometry args={[width, height, width * 0.4]} />
<meshStandardMaterial
- color="#0a0a18"
+ color={tintStructure('#0a0a18')}
emissive={color}
emissiveIntensity={opacity}
transparent
diff --git a/client/src/components/city/CityGoalMonuments.jsx b/client/src/components/city/CityGoalMonuments.jsx
index be219c648f..547e4b7306 100644
--- a/client/src/components/city/CityGoalMonuments.jsx
+++ b/client/src/components/city/CityGoalMonuments.jsx
@@ -1,7 +1,7 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
import CityTubeLine from './CityTubeLine';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeGoalMonuments, computeGoalForest, MONUMENTS, FOREST } from '../../utils/cityGoalMonuments';
@@ -40,7 +40,7 @@ function MonumentBody({ monument, shimmerRef, isShimmer }) {
>
<boxGeometry args={doneFloor ? [width, floorH, width] : [width * 1.05, floorH, width * 1.05]} />
<meshStandardMaterial
- color={doneFloor ? (built ? '#0d1a12' : '#0c1424') : color}
+ color={doneFloor ? (built ? tintStructure('#0d1a12') : tintStructure('#0c1424')) : color}
emissive={color}
emissiveIntensity={doneFloor ? intensity : intensity * 0.45}
metalness={doneFloor ? (built ? 0.7 : 0.4) : 0.2}
@@ -65,7 +65,7 @@ function MonumentBody({ monument, shimmerRef, isShimmer }) {
<mesh ref={isShimmer ? shimmerRef : undefined} position={[0, 0.4 + builtHeight / 2, 0]}>
<boxGeometry args={[width, builtHeight, width]} />
<meshStandardMaterial
- color={built ? '#0d1a12' : '#0c1424'}
+ color={built ? tintStructure('#0d1a12') : tintStructure('#0c1424')}
emissive={color}
emissiveIntensity={intensity}
metalness={built ? 0.7 : 0.4}
@@ -93,7 +93,7 @@ function Monument({ monument, shimmerRef, isShimmer, dayMix = 0 }) {
{/* Plinth */}
<mesh position={[0, 0.2, 0]}>
<boxGeometry args={[width * 1.4, 0.4, width * 1.4]} />
- <meshStandardMaterial color="#0a0e16" emissive={color} emissiveIntensity={0.1 * intensity + 0.04} metalness={0.6} roughness={0.5} />
+ <meshStandardMaterial color={tintStructure('#0a0e16')} emissive={color} emissiveIntensity={0.1 * intensity + 0.04} metalness={0.6} roughness={0.5} />
</mesh>
<MonumentBody monument={monument} shimmerRef={shimmerRef} isShimmer={isShimmer} />
@@ -239,7 +239,7 @@ export default function CityGoalMonuments({ goals, settings }) {
<group position={overflow.position}>
<mesh position={[0, MONUMENTS.minHeight / 2, 0]}>
<boxGeometry args={[MONUMENTS.baseWidth, MONUMENTS.minHeight, MONUMENTS.baseWidth]} />
- <meshStandardMaterial color="#0c1424" emissive="#64748b" emissiveIntensity={0.2} metalness={0.5} roughness={0.6} />
+ <meshStandardMaterial color={tintStructure('#0c1424')} emissive="#64748b" emissiveIntensity={0.2} metalness={0.5} roughness={0.6} />
</mesh>
<CityLabel position={[0, MONUMENTS.minHeight + 1, 0]} fontSize={0.6} color="#94a3b8" dayMix={dayMix} anchorX="center" anchorY="middle" font={PIXEL_FONT_URL} maxWidth={9}>
{`+${overflow.count} MORE`}
diff --git a/client/src/components/city/CityHealthTower.jsx b/client/src/components/city/CityHealthTower.jsx
index 3fea897495..fe1b1be239 100644
--- a/client/src/components/city/CityHealthTower.jsx
+++ b/client/src/components/city/CityHealthTower.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeHealthTower } from '../../utils/cityHealthTower';
@@ -16,7 +16,7 @@ function Segment({ segment, baseRadius, isHeart, heartRef }) {
<mesh ref={isHeart ? heartRef : undefined} position={[0, segment.y, 0]}>
<cylinderGeometry args={[baseRadius, baseRadius, height, 32]} />
<meshStandardMaterial
- color={segment.present ? '#0c1620' : '#0a0e16'}
+ color={segment.present ? tintStructure('#0c1620') : tintStructure('#0a0e16')}
emissive={color}
emissiveIntensity={intensity}
metalness={0.5}
@@ -52,7 +52,7 @@ export default function CityHealthTower({ healthMetrics, settings }) {
{/* Plinth the tower rises from */}
<mesh position={[0, 0.3, 0]}>
<cylinderGeometry args={[baseRadius * 1.3, baseRadius * 1.45, 0.6, 32]} />
- <meshStandardMaterial color="#0a0e16" emissive="#22c55e" emissiveIntensity={0.08} metalness={0.6} roughness={0.5} />
+ <meshStandardMaterial color={tintStructure('#0a0e16')} emissive="#22c55e" emissiveIntensity={0.08} metalness={0.6} roughness={0.5} />
</mesh>
{/* Stacked metric segments — lifted above the plinth */}
diff --git a/client/src/components/city/CityJiraDistrict.jsx b/client/src/components/city/CityJiraDistrict.jsx
index 52442d8e48..704b7cad99 100644
--- a/client/src/components/city/CityJiraDistrict.jsx
+++ b/client/src/components/city/CityJiraDistrict.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeJiraDistrict, JIRA_DISTRICT } from '../../utils/cityJiraDistrict';
@@ -22,7 +22,7 @@ function SprintStructure({ structure, pulseRef, isPulse }) {
<group position={position}>
<mesh position={[0, height / 2, 0]}>
<boxGeometry args={[size, height, size]} />
- <meshStandardMaterial color="#0d1a12" emissive={color} emissiveIntensity={0.7} metalness={0.6} roughness={0.4} toneMapped={false} />
+ <meshStandardMaterial color={tintStructure('#0d1a12')} emissive={color} emissiveIntensity={0.7} metalness={0.6} roughness={0.4} toneMapped={false} />
</mesh>
</group>
);
diff --git a/client/src/components/city/CityMemoryDistrict.jsx b/client/src/components/city/CityMemoryDistrict.jsx
index 2e6040a23a..4e2ead9fb5 100644
--- a/client/src/components/city/CityMemoryDistrict.jsx
+++ b/client/src/components/city/CityMemoryDistrict.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import CityTubeLine from './CityTubeLine';
import { computeMemoryDistrict, MEMORY_DISTRICT } from '../../utils/cityMemoryDistrict';
@@ -88,7 +88,7 @@ export default function CityMemoryDistrict({ memoryGraph, inboxDepth = 0, settin
// Inbox well: glows brighter and pulses faster the deeper the unclassified backlog.
const inboxActive = inboxDepth > 0;
- const wellColor = inboxActive ? '#06b6d4' : '#1e3a5f';
+ const wellColor = inboxActive ? '#06b6d4' : tintStructure('#1e3a5f');
useFrame(({ clock }) => {
const t = clock.getElapsedTime();
diff --git a/client/src/components/city/CityProductivityDistrict.jsx b/client/src/components/city/CityProductivityDistrict.jsx
index e904cfd464..78e321fc9a 100644
--- a/client/src/components/city/CityProductivityDistrict.jsx
+++ b/client/src/components/city/CityProductivityDistrict.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeProductivityMonument } from '../../utils/cityProductivity';
@@ -38,11 +38,11 @@ export default function CityProductivityDistrict({ productivityData, settings })
{/* Stepped plinth the obelisk rises from */}
<mesh position={[0, 0.4, 0]}>
<boxGeometry args={[baseWidth * 1.6, 0.8, baseWidth * 1.6]} />
- <meshStandardMaterial color="#0a0e16" emissive={color} emissiveIntensity={0.08} metalness={0.6} roughness={0.5} />
+ <meshStandardMaterial color={tintStructure('#0a0e16')} emissive={color} emissiveIntensity={0.08} metalness={0.6} roughness={0.5} />
</mesh>
<mesh position={[0, 1.0, 0]}>
<boxGeometry args={[baseWidth * 1.2, 0.5, baseWidth * 1.2]} />
- <meshStandardMaterial color="#0c121d" emissive={color} emissiveIntensity={0.12} metalness={0.6} roughness={0.5} />
+ <meshStandardMaterial color={tintStructure('#0c121d')} emissive={color} emissiveIntensity={0.12} metalness={0.6} roughness={0.5} />
</mesh>
{/* Tapered obelisk shaft — height scales with the streak */}
@@ -50,7 +50,7 @@ export default function CityProductivityDistrict({ productivityData, settings })
<mesh position={[0, shaftTop / 2, 0]}>
<cylinderGeometry args={[baseWidth * 0.18, baseWidth * 0.42, shaftTop, 4]} />
<meshStandardMaterial
- color="#0a0e16"
+ color={tintStructure('#0a0e16')}
emissive={color}
emissiveIntensity={0.12 + monument.intensity * 0.25}
metalness={0.6}
diff --git a/client/src/components/city/CitySignalBeacons.jsx b/client/src/components/city/CitySignalBeacons.jsx
index 28380de526..058b8dfdb5 100644
--- a/client/src/components/city/CitySignalBeacons.jsx
+++ b/client/src/components/city/CitySignalBeacons.jsx
@@ -1,7 +1,7 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
function SignalBeacon({ position, color, label, sublabel, intensity = 1, dayMix = 0 }) {
@@ -34,7 +34,7 @@ function SignalBeacon({ position, color, label, sublabel, intensity = 1, dayMix
<mesh position={[0, 0.15, 0]}>
<cylinderGeometry args={[0.35, 0.45, 0.3, 10]} />
- <meshStandardMaterial color="#0a0a18" emissive={color} emissiveIntensity={0.35 * intensity} />
+ <meshStandardMaterial color={tintStructure('#0a0a18')} emissive={color} emissiveIntensity={0.35 * intensity} />
</mesh>
<mesh position={[0, 0.42, 0]}>
diff --git a/client/src/components/city/CitySky.jsx b/client/src/components/city/CitySky.jsx
index 03427b5b34..d5a60d6cca 100644
--- a/client/src/components/city/CitySky.jsx
+++ b/client/src/components/city/CitySky.jsx
@@ -1,7 +1,7 @@
import { useRef, useMemo } from 'react';
import { useFrame } from '@react-three/fiber';
import * as THREE from 'three';
-import { getTimeOfDayPreset } from './cityConstants';
+import { getTimeOfDayPreset, tintTowardAccent, CITY_COLORS } from './cityConstants';
const SUN_RADIUS = 100;
@@ -103,15 +103,19 @@ const lerpColor = (target, a, b, t) => {
target.b = a.b + (b.b - a.b) * t;
};
-// Pre-allocate parsed preset colors (keyed by "theme:timeOfDay")
+// Pre-allocate parsed preset colors (keyed by "theme:timeOfDay:accent"). The upper
+// sky bands (zenith, midSky) are tinted toward the active theme accent so the sky
+// tracks the theme; horizon haze + sun colors stay physical/untinted. The accent is
+// in the cache key so a theme switch re-derives instead of serving a stale tint.
const presetColors = {};
const getPresetColors = (name, skyTheme) => {
- const cacheKey = `${skyTheme}:${name}`;
+ const accent = CITY_COLORS.ground;
+ const cacheKey = `${skyTheme}:${name}:${accent}`;
if (!presetColors[cacheKey]) {
const p = getTimeOfDayPreset(name, skyTheme);
presetColors[cacheKey] = {
- zenith: new THREE.Color(p.zenith),
- midSky: new THREE.Color(p.midSky),
+ zenith: new THREE.Color(tintTowardAccent(p.zenith, 0.16)),
+ midSky: new THREE.Color(tintTowardAccent(p.midSky, 0.12)),
horizonHigh: new THREE.Color(p.horizonHigh),
horizonLow: new THREE.Color(p.horizonLow),
sunCore: new THREE.Color(p.sunCore),
diff --git a/client/src/components/city/CityTaskQueue.jsx b/client/src/components/city/CityTaskQueue.jsx
index 9b35062c5b..ffc7d2d38d 100644
--- a/client/src/components/city/CityTaskQueue.jsx
+++ b/client/src/components/city/CityTaskQueue.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeTaskQueue, TASK_QUEUE } from '../../utils/cityTaskQueue';
@@ -60,7 +60,7 @@ export default function CityTaskQueue({ cosTasks, settings }) {
{/* Warehouse base — a wide low dock the crates sit on */}
<mesh position={[0, warehouseHeight / 2, 0]}>
<boxGeometry args={[warehouseWidth, warehouseHeight, warehouseWidth * 0.9]} />
- <meshStandardMaterial color="#0c1620" emissive={color} emissiveIntensity={0.1} metalness={0.4} roughness={0.6} />
+ <meshStandardMaterial color={tintStructure('#0c1620')} emissive={color} emissiveIntensity={0.1} metalness={0.4} roughness={0.6} />
</mesh>
{/* Roof light bar — the live queue-state indicator */}
<mesh ref={roofRef} position={[0, warehouseHeight + 0.2, 0]}>
diff --git a/client/src/components/city/CityVoiceMarker.jsx b/client/src/components/city/CityVoiceMarker.jsx
index 8e0fbd8312..7b5f123c91 100644
--- a/client/src/components/city/CityVoiceMarker.jsx
+++ b/client/src/components/city/CityVoiceMarker.jsx
@@ -1,6 +1,6 @@
import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
-import { PIXEL_FONT_URL, cityDayMix } from './cityConstants';
+import { PIXEL_FONT_URL, cityDayMix, tintStructure } from './cityConstants';
import CityLabel from './CityLabel';
import { computeVoiceMarker } from '../../utils/cityVoiceMarker';
@@ -38,7 +38,7 @@ export default function CityVoiceMarker({ voiceState, settings }) {
{/* Low disc base — anchors the marker to the ground */}
<mesh position={[0, 0.1, 0]}>
<cylinderGeometry args={[baseRadius, baseRadius * 1.15, 0.2, 24]} />
- <meshStandardMaterial color="#0c1620" emissive={color} emissiveIntensity={0.12} metalness={0.5} roughness={0.6} />
+ <meshStandardMaterial color={tintStructure('#0c1620')} emissive={color} emissiveIntensity={0.12} metalness={0.5} roughness={0.6} />
</mesh>
{/* Slim antenna pole */}
<mesh position={[0, poleHeight / 2, 0]}>
diff --git a/client/src/components/city/ProcessBuilding.jsx b/client/src/components/city/ProcessBuilding.jsx
index c8f149979f..bb2bf9afe6 100644
--- a/client/src/components/city/ProcessBuilding.jsx
+++ b/client/src/components/city/ProcessBuilding.jsx
@@ -4,13 +4,21 @@ import * as THREE from 'three';
import { CITY_COLORS, PROCESS_BUILDING_PARAMS, PIXEL_FONT_URL, mixHex } from './cityConstants';
import CityLabel from './CityLabel';
-const STATUS_COLORS = {
- online: '#06b6d4',
- stopped: '#f59e0b',
- not_found: '#6366f1',
- // PM2's canonical status string is "errored"; some legacy callers send "error".
- errored: '#ef4444',
- error: '#ef4444',
+// Process status → color, unified with CITY_COLORS.building (read live so 'online'
+// follows the active theme accent and the semantic colors match a stopped/missing
+// *app*): 'stopped' is the same red as a stopped app (was amber), 'not_found' the
+// same purple (was indigo). PM2's hard-failure states ("errored"; some legacy
+// callers send "error") read as the same red as stopped — both mean "down".
+const getProcessColor = (status) => {
+ const b = CITY_COLORS.building;
+ switch (status) {
+ case 'online': return b.online;
+ case 'stopped':
+ case 'errored':
+ case 'error': return b.stopped;
+ case 'not_found':
+ default: return b.not_found;
+ }
};
export default function ProcessBuilding({ process, pm2Status, position, seed, dimmed = false, dayMix = 0 }) {
@@ -18,7 +26,7 @@ export default function ProcessBuilding({ process, pm2Status, position, seed, di
const glowRef = useRef();
const status = pm2Status?.status || 'not_found';
- const color = STATUS_COLORS[status] || STATUS_COLORS.not_found;
+ const color = getProcessColor(status);
const { width, depth } = PROCESS_BUILDING_PARAMS;
const dimMul = dimmed ? 0.25 : 1;
// Match the main Building's daytime treatment — sheds neon, lightens to a lit solid.
diff --git a/client/src/components/city/cityConstants.js b/client/src/components/city/cityConstants.js
index 9e1832e3ca..e52bb42545 100644
--- a/client/src/components/city/cityConstants.js
+++ b/client/src/components/city/cityConstants.js
@@ -333,6 +333,11 @@ export const getAccentColor = (app) => {
// switches don't compound; ORIGINAL_GROUND is only the fallback for a theme that
// somehow has no accent.
const ORIGINAL_GROUND = CITY_COLORS.ground;
+// The dark building body + window-grid bases default to a cyber near-black. We
+// re-tint them toward the theme accent on a theme switch (see applyCityBrandColors
+// / tintStructure), so capture the cyan-era originals to recompute from — never
+// from the already-tinted value, or repeated switches compound.
+const ORIGINAL_BUILDING_BODY = CITY_COLORS.buildingBody;
// Shared color primitives. parseHex: "#0a7a4a" -> [10, 122, 74] (null on bad input).
// toHex: clamps/rounds each channel back to "#rrggbb".
@@ -373,6 +378,28 @@ export const mixHex = (a, b, t) => {
return ca && cb ? toHex(...ca.map((c, i) => c + (cb[i] - c) * t)) : a;
};
+// Tint a color toward the active theme accent (the live CITY_COLORS.ground) by
+// `amount`, then rescale to the original luminance so ONLY hue/saturation shift —
+// the scene's brightness hierarchy (dark structural bases stay dark, bright sky
+// bands stay bright) is preserved while every surface picks up the theme. Reads the
+// live accent so it tracks theme switches. Pure aside from that read; null-safe.
+export const tintTowardAccent = (hex, amount = 0.2) => {
+ const base = parseHex(hex);
+ const accent = parseHex(CITY_COLORS.ground);
+ if (!base || !accent) return hex;
+ const lum = (c) => 0.299 * c[0] + 0.587 * c[1] + 0.114 * c[2];
+ const lb = lum(base);
+ if (lb === 0) return hex; // pure black has no hue to tint
+ const mixed = base.map((c, i) => c + (accent[i] - c) * amount);
+ const lm = lum(mixed) || 1;
+ const k = lb / lm; // rescale mixed back to the base's luminance
+ return toHex(mixed[0] * k, mixed[1] * k, mixed[2] * k);
+};
+
+// Convenience for the dark structural bases (building bodies, district plinths,
+// monument footings) — a slightly stronger tint than the default.
+export const tintStructure = (hex) => tintTowardAccent(hex, 0.22);
+
// GLSL-style smoothstep with an edge remap (distinct from the plain Hermite
// smoothstep(t) in utils/easing.js — different arity, kept local on purpose).
const smoothstepRange = (a, b, x) => {
@@ -441,4 +468,8 @@ export const applyCityBrandColors = (palette) => {
CITY_COLORS.particles = accent;
CITY_COLORS.building.online = accent;
CITY_COLORS.neonAccents[0] = accent;
+ // Ground must be set first — tintStructure reads CITY_COLORS.ground. Re-tint the
+ // dark building body toward the accent (luminance preserved) so structures track
+ // the theme too, not just the neon brand surfaces.
+ CITY_COLORS.buildingBody = tintStructure(ORIGINAL_BUILDING_BODY);
};
diff --git a/client/src/components/city/cityTheme.test.js b/client/src/components/city/cityTheme.test.js
index 0f9946b311..49b1d40084 100644
--- a/client/src/components/city/cityTheme.test.js
+++ b/client/src/components/city/cityTheme.test.js
@@ -1,5 +1,15 @@
import { describe, it, expect, beforeEach } from 'vitest';
-import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay, cityLabelColors, CITY_COLORS, getBuildingColor } from './cityConstants';
+import { deriveCityPalette, applyCityBrandColors, resolveCityTimeOfDay, cityLabelColors, tintTowardAccent, tintStructure, CITY_COLORS, getBuildingColor } from './cityConstants';
+
+const hexLum = (hex) => {
+ const n = parseInt(hex.slice(1), 16);
+ const r = (n >> 16) & 255, g = (n >> 8) & 255, b = n & 255;
+ return 0.299 * r + 0.587 * g + 0.114 * b;
+};
+const hexChannels = (hex) => {
+ const n = parseInt(hex.slice(1), 16);
+ return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
+};
import { getTheme, THEMES } from '../../themes/portosThemes';
describe('deriveCityPalette', () => {
@@ -115,6 +125,39 @@ describe('cityLabelColors', () => {
});
});
+describe('tintTowardAccent / tintStructure', () => {
+ // These read the live CITY_COLORS.ground accent; set/restore it per test.
+ let savedGround;
+ beforeEach(() => { savedGround = CITY_COLORS.ground; });
+ afterEach(() => { CITY_COLORS.ground = savedGround; });
+
+ it('shifts hue toward the accent while preserving luminance', () => {
+ CITY_COLORS.ground = '#ff0000'; // pure red accent
+ const base = '#0a0e16'; // a dark blue-dominant structural base
+ const out = tintStructure(base);
+ // Luminance preserved within rounding — the base stays just as dark.
+ expect(hexLum(out)).toBeCloseTo(hexLum(base), 0);
+ // Hue pulled toward red: the red channel rises relative to the original.
+ expect(hexChannels(out)[0]).toBeGreaterThan(hexChannels(base)[0]);
+ });
+
+ it('leaves pure black untouched (no hue to tint)', () => {
+ CITY_COLORS.ground = '#22c55e';
+ expect(tintTowardAccent('#000000')).toBe('#000000');
+ });
+
+ it('is a no-op-ish identity when the accent equals the base hue direction', () => {
+ CITY_COLORS.ground = '#0a0e16';
+ // Tinting toward itself preserves the color (luminance + channels unchanged).
+ expect(hexLum(tintStructure('#0a0e16'))).toBeCloseTo(hexLum('#0a0e16'), 0);
+ });
+
+ it('returns the input unchanged for an unparseable color', () => {
+ CITY_COLORS.ground = '#22c55e';
+ expect(tintTowardAccent('not-a-hex')).toBe('not-a-hex');
+ });
+});
+
describe('applyCityBrandColors', () => {
// Restore the cyan baseline after each test so mutation doesn't leak across the suite.
beforeEach(() => applyCityBrandColors(deriveCityPalette(undefined)));
@@ -133,6 +176,27 @@ describe('applyCityBrandColors', () => {
applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));
expect(CITY_COLORS.building.stopped).toBe('#ef4444');
expect(getBuildingColor('stopped')).toBe('#ef4444');
+ // not_found stays the canonical purple — the value ProcessBuilding now unifies to.
+ expect(CITY_COLORS.building.not_found).toBe('#8b5cf6');
+ });
+
+ it('re-tints the building body toward the accent, preserving its darkness', () => {
+ const ORIGINAL_BODY = '#0c0c24';
+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day'))); // green accent
+ const themed = CITY_COLORS.buildingBody;
+ expect(themed).not.toBe(ORIGINAL_BODY); // picked up the theme
+ expect(hexLum(themed)).toBeCloseTo(hexLum(ORIGINAL_BODY), 0); // still a dark body
+ });
+
+ it('recomputes the building body from the original, not compounding across switches', () => {
+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));
+ const greenBody = CITY_COLORS.buildingBody;
+ applyCityBrandColors(deriveCityPalette(getTheme('classic-midnight')));
+ const blueBody = CITY_COLORS.buildingBody;
+ // Switching back yields the same value — proof it recomputes from ORIGINAL_BUILDING_BODY.
+ applyCityBrandColors(deriveCityPalette(getTheme('black-ice-terminal-day')));
+ expect(CITY_COLORS.buildingBody).toBe(greenBody);
+ expect(blueBody).not.toBe(greenBody);
});
it('recomputes from the cyan baseline rather than compounding across switches', () => {