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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add port-accent-2 token, finish chart theming sweep (#1909)
[._.]/ Adam Eivybd9864aa2d1e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex a0e95fe42d..584746b5f1 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -52,6 +52,7 @@## UX & Theming- **[issue-1851] Charts, button hovers, and terminal panels now follow the active theme** — several of the most-visible colors were hardcoded and stayed put when you switched themes. The health/meatspace charts (alcohol consumption, metric trend cards) drew their bars, gridlines, axes, reference lines, and tooltips with fixed hex values because chart SVG props can't read CSS variables; a new `useChartColors()` hook resolves the theme's `--port-*` tokens at render and re-resolves on theme switch, so charts now recolor with the rest of the app. The 13 primary call-to-action buttons across Goals, Story Builder, and Jira Reports used a hardcoded blue hover (`hover:bg-blue-600`) that diverged from a non-blue accent theme; they now hover as a shade of the active accent. The Chief-of-Staff terminal panel and the GSD/app document editors that hardcoded near-black backgrounds now use the theme's terminal-background token, and the Writers Room reading-mode ink color is centralized. (A broader sweep of the remaining ~900 off-token color utilities and a semantic purple token are tracked separately in #1909.) (#1851)+- **[issue-1909] New `--port-accent-2` (purple/violet) semantic token, plus the rest of the recharts cards now follow the active theme** — the remaining 8 chart files without `useChartColors()` (`ActivityBloodCorrelation`, `AlcoholHrvCorrelation`, `BloodPressureCard`, `BodyCompChart`, `NicotineChart`, `NicotineHealthCorrelation`, POST history, sleep stages) are converted, leaving every recharts site in the app theme-aware. Purple/violet/indigo had no `--port-*` equivalent, so AI-recommendation and secondary-emphasis highlights (Epigenetic Tracker's curated recommendations, the Chief of Staff "Learning: good" indicator) stayed a fixed purple regardless of theme; `--port-accent-2` is now defined and tuned per-theme across all 8 PortOS themes. The `cos/tabs/AgentCard.jsx` JIRA ticket badge and link (base + hover) are remapped onto `--port-accent`. This is one bounded, reviewable slice of the ~900-site sweep — the remainder is tracked by feature area in #1924, including a caution against blindly remapping the several category-color enum files (e.g. `GenomeCategoryCard.jsx`, `bucketColors.js`) that use multi-hue palettes to differentiate categories rather than express theme drift. (#1909)## UX & Accessibilitydiff --git a/client/src/components/cos/tabs/AgentCard.jsx b/client/src/components/cos/tabs/AgentCard.jsxindex 3a2504ec21..9559770820 100644--- a/client/src/components/cos/tabs/AgentCard.jsx+++ b/client/src/components/cos/tabs/AgentCard.jsx@@ -591,7 +591,7 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,{/* JIRA ticket info */}{agent.metadata?.jiraTicketId && (<div className="flex items-center gap-2 mb-2">- <span className="px-2 py-0.5 text-xs bg-blue-500/20 text-blue-400 rounded font-mono">+ <span className="px-2 py-0.5 text-xs bg-port-accent/20 text-port-accent rounded font-mono">{agent.metadata.jiraTicketId}</span>{agent.metadata?.jiraTicketUrl && (@@ -599,7 +599,7 @@ export default function AgentCard({ agent, onPause, onKill, onDelete, onResume,href={agent.metadata.jiraTicketUrl}target="_blank"rel="noopener noreferrer"- className="flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors"+ className="flex items-center gap-1 text-xs text-port-accent hover:text-port-accent/80 transition-colors"title="Open JIRA ticket in new tab">View ticketdiff --git a/client/src/components/meatspace/ActivityBloodCorrelation.jsx b/client/src/components/meatspace/ActivityBloodCorrelation.jsxindex 02458e3018..1b1248a7db 100644--- a/client/src/components/meatspace/ActivityBloodCorrelation.jsx+++ b/client/src/components/meatspace/ActivityBloodCorrelation.jsx@@ -1,6 +1,7 @@import {ComposedChart, Bar, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';+import useChartColors from '../../hooks/useChartColors.js';// Blood markers to chart — prefer common ones if available in the test resultsconst PREFERRED_MARKERS = ['cholesterol', 'glucose', 'ldl', 'hdl', 'triglycerides'];@@ -27,13 +28,11 @@ function pickMarkers(bloodTests) {return found;}-const MARKER_COLORS = ['#3b82f6', '#8b5cf6', '#f59e0b'];--const CustomTooltip = ({ active, payload, label }) => {+const CustomTooltip = ({ active, payload, label, colors }) => {if (!active || !payload?.length) return null;return (- <div style={{ background: '#1a1a1a', border: '1px solid #2a2a2a', color: '#fff', padding: '8px', borderRadius: '6px', fontSize: '12px' }}>- <p style={{ color: '#9ca3af', marginBottom: 4 }}>{label}</p>+ <div style={{ background: colors.tooltipBg, border: `1px solid ${colors.tooltipBorder}`, color: colors.text, padding: '8px', borderRadius: '6px', fontSize: '12px' }}>+ <p style={{ color: colors.axis, marginBottom: 4 }}>{label}</p>{payload.map((entry) => (<p key={entry.dataKey} style={{ color: entry.color ?? entry.fill, margin: '2px 0' }}>{entry.name}: {entry.value != null ? Math.round(entry.value).toLocaleString() : '—'}@@ -45,6 +44,8 @@ const CustomTooltip = ({ active, payload, label }) => {};export default function ActivityBloodCorrelation({ data, range }) {+ const chartColors = useChartColors();+ const markerColors = [chartColors.chart1, chartColors.chart2, chartColors.chart3];const dailyData = data?.dailyData ?? [];const bloodTests = data?.bloodTests ?? [];@@ -100,32 +101,32 @@ export default function ActivityBloodCorrelation({ data, range }) {<ResponsiveContainer width="100%" height={220}><ComposedChart data={chartData} margin={{ top: 5, right: 40, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />- <XAxis dataKey="date" tick={{ fill: '#9ca3af', fontSize: 11 }} />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} />+ <XAxis dataKey="date" tick={{ fill: chartColors.axis, fontSize: 11 }} /><YAxisyAxisId="steps"orientation="left"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={60}tickFormatter={v => v.toLocaleString()}- label={{ value: 'Steps (30d avg)', angle: -90, position: 'insideLeft', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'Steps (30d avg)', angle: -90, position: 'insideLeft', fill: chartColors.axis, fontSize: 10 }}/>{markers.length > 0 && (<YAxisyAxisId="markers"orientation="right"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={40}- label={{ value: 'Blood (mg/dL)', angle: 90, position: 'insideRight', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'Blood (mg/dL)', angle: 90, position: 'insideRight', fill: chartColors.axis, fontSize: 10 }}/>)}- <Tooltip content={<CustomTooltip />} />- <Legend wrapperStyle={{ fontSize: 11, color: '#9ca3af' }} />+ <Tooltip content={<CustomTooltip colors={chartColors} />} />+ <Legend wrapperStyle={{ fontSize: 11, color: chartColors.axis }} /><BaryAxisId="steps"dataKey="steps"name="30d Avg Steps"- fill="#6b7280"+ fill={chartColors.axis}opacity={0.6}maxBarSize={40}/>@@ -136,9 +137,9 @@ export default function ActivityBloodCorrelation({ data, range }) {type="monotone"dataKey={marker}name={marker.charAt(0).toUpperCase() + marker.slice(1)}- stroke={MARKER_COLORS[i]}+ stroke={markerColors[i]}strokeWidth={2}- dot={{ r: 4, fill: MARKER_COLORS[i] }}+ dot={{ r: 4, fill: markerColors[i] }}connectNulls/>))}diff --git a/client/src/components/meatspace/AlcoholHrvCorrelation.jsx b/client/src/components/meatspace/AlcoholHrvCorrelation.jsxindex e3dafe612c..3c19c5a503 100644--- a/client/src/components/meatspace/AlcoholHrvCorrelation.jsx+++ b/client/src/components/meatspace/AlcoholHrvCorrelation.jsx@@ -2,12 +2,13 @@ import { HeartPulse, Beer } from 'lucide-react';import {ComposedChart, Line, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';+import useChartColors from '../../hooks/useChartColors.js';-const CustomTooltip = ({ active, payload, label }) => {+const CustomTooltip = ({ active, payload, label, colors }) => {if (!active || !payload?.length) return null;return (- <div style={{ background: '#1a1a1a', border: '1px solid #2a2a2a', color: '#fff', padding: '8px', borderRadius: '6px', fontSize: '12px' }}>- <p style={{ color: '#9ca3af', marginBottom: 4 }}>{label}</p>+ <div style={{ background: colors.tooltipBg, border: `1px solid ${colors.tooltipBorder}`, color: colors.text, padding: '8px', borderRadius: '6px', fontSize: '12px' }}>+ <p style={{ color: colors.axis, marginBottom: 4 }}>{label}</p>{payload.map((entry) => (<p key={entry.dataKey} style={{ color: entry.color ?? entry.fill, margin: '2px 0' }}>{entry.name}: {entry.value != null ? Math.round(entry.value * 100) / 100 : '—'}@@ -35,6 +36,7 @@ function computeSummary(dailyData) {}export default function AlcoholHrvCorrelation({ data, range }) {+ const chartColors = useChartColors();const dailyData = data?.dailyData ?? [];if (dailyData.length < 14) {@@ -71,30 +73,30 @@ export default function AlcoholHrvCorrelation({ data, range }) {<ResponsiveContainer width="100%" height={220}><ComposedChart data={chartData} margin={{ top: 5, right: 40, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />- <XAxis dataKey="date" tick={{ fill: '#9ca3af', fontSize: 11 }} interval="preserveStartEnd" />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} />+ <XAxis dataKey="date" tick={{ fill: chartColors.axis, fontSize: 11 }} interval="preserveStartEnd" /><YAxisyAxisId="hrv"orientation="left"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={40}- label={{ value: 'HRV (ms)', angle: -90, position: 'insideLeft', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'HRV (ms)', angle: -90, position: 'insideLeft', fill: chartColors.axis, fontSize: 10 }}/><YAxisyAxisId="alcohol"orientation="right"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={40}- label={{ value: 'Alcohol (g)', angle: 90, position: 'insideRight', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'Alcohol (g)', angle: 90, position: 'insideRight', fill: chartColors.axis, fontSize: 10 }}/>- <Tooltip content={<CustomTooltip />} />- <Legend wrapperStyle={{ fontSize: 11, color: '#9ca3af' }} />+ <Tooltip content={<CustomTooltip colors={chartColors} />} />+ <Legend wrapperStyle={{ fontSize: 11, color: chartColors.axis }} /><LineyAxisId="hrv"type="monotone"dataKey="hrv"name="HRV"- stroke="#22c55e"+ stroke={chartColors.success}strokeWidth={2}dot={false}connectNulls@@ -103,7 +105,7 @@ export default function AlcoholHrvCorrelation({ data, range }) {yAxisId="alcohol"dataKey="alcohol"name="Alcohol"- fill="#f59e0b"+ fill={chartColors.warning}opacity={0.7}maxBarSize={12}/>diff --git a/client/src/components/meatspace/BloodPressureCard.jsx b/client/src/components/meatspace/BloodPressureCard.jsxindex a3626fbb31..8d5c57adc3 100644--- a/client/src/components/meatspace/BloodPressureCard.jsx+++ b/client/src/components/meatspace/BloodPressureCard.jsx@@ -5,8 +5,15 @@ import {import { HeartPulse, Plus, X, Check, TrendingUp, TrendingDown } from 'lucide-react';import * as api from '../../services/api';import BrailleSpinner from '../BrailleSpinner';+import useChartColors from '../../hooks/useChartColors.js';import { classifyBP, bpLongevityImpact, BP_CATEGORIES } from './bpClassification';+// Stage 1 hypertension reference line sits between the warning (elevated) and+// error (stage 2) tokens — an intentional 3-tier severity escalation with no+// matching --port-* token, so it stays a literal color rather than collapsing+// onto warning or error and losing the middle step.+const BP_STAGE_1_COLOR = '#f97316';+const EMPTY_FORM = { date: '', systolic: '', diastolic: '' };function parseNum(v) {@@ -16,6 +23,7 @@ function parseNum(v) {}export default function BloodPressureCard() {+ const chartColors = useChartColors();const [readings, setReadings] = useState([]);const [loading, setLoading] = useState(true);const [showForm, setShowForm] = useState(false);@@ -154,24 +162,24 @@ export default function BloodPressureCard() {<><ResponsiveContainer width="100%" height={260}><LineChart data={chartData} margin={{ top: 5, right: 5, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} /><XAxisdataKey="label"- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}interval={Math.max(0, Math.floor(chartData.length / 12))}/><YAxis- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}domain={[dataMin => Math.max(40, Math.floor(dataMin - 10)), dataMax => Math.ceil(dataMax + 10)]}- label={{ value: 'mmHg', angle: -90, position: 'insideLeft', fill: '#6b7280', fontSize: 11 }}+ label={{ value: 'mmHg', angle: -90, position: 'insideLeft', fill: chartColors.axis, fontSize: 11 }}/><Tooltip content={<CustomTooltip />} /><Legend />- <ReferenceLine y={120} stroke="#f59e0b" strokeDasharray="3 3" label={{ value: 'Elevated', fill: '#f59e0b', fontSize: 10, position: 'right' }} />- <ReferenceLine y={130} stroke="#f97316" strokeDasharray="3 3" label={{ value: 'Stage 1', fill: '#f97316', fontSize: 10, position: 'right' }} />- <ReferenceLine y={140} stroke="#ef4444" strokeDasharray="3 3" label={{ value: 'Stage 2', fill: '#ef4444', fontSize: 10, position: 'right' }} />- <Line type="monotone" dataKey="systolic" name="Systolic" stroke="#ef4444" dot={chartData.length <= 90} strokeWidth={2} connectNulls />- <Line type="monotone" dataKey="diastolic" name="Diastolic" stroke="#3b82f6" dot={chartData.length <= 90} strokeWidth={2} connectNulls />+ <ReferenceLine y={120} stroke={chartColors.warning} strokeDasharray="3 3" label={{ value: 'Elevated', fill: chartColors.warning, fontSize: 10, position: 'right' }} />+ <ReferenceLine y={130} stroke={BP_STAGE_1_COLOR} strokeDasharray="3 3" label={{ value: 'Stage 1', fill: BP_STAGE_1_COLOR, fontSize: 10, position: 'right' }} />+ <ReferenceLine y={140} stroke={chartColors.error} strokeDasharray="3 3" label={{ value: 'Stage 2', fill: chartColors.error, fontSize: 10, position: 'right' }} />+ <Line type="monotone" dataKey="systolic" name="Systolic" stroke={chartColors.error} dot={chartData.length <= 90} strokeWidth={2} connectNulls />+ <Line type="monotone" dataKey="diastolic" name="Diastolic" stroke={chartColors.accent} dot={chartData.length <= 90} strokeWidth={2} connectNulls /></LineChart></ResponsiveContainer>diff --git a/client/src/components/meatspace/BodyCompChart.jsx b/client/src/components/meatspace/BodyCompChart.jsxindex e27be2cc4e..2d551bc670 100644--- a/client/src/components/meatspace/BodyCompChart.jsx+++ b/client/src/components/meatspace/BodyCompChart.jsx@@ -4,8 +4,10 @@ import {} from 'recharts';import * as api from '../../services/api';import BrailleSpinner from '../BrailleSpinner';+import useChartColors from '../../hooks/useChartColors.js';export default function BodyCompChart() {+ const chartColors = useChartColors();const [data, setData] = useState([]);const [loading, setLoading] = useState(true);@@ -69,22 +71,22 @@ export default function BodyCompChart() {</h3><ResponsiveContainer width="100%" height={300}><LineChart data={data} margin={{ top: 5, right: 5, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} /><XAxisdataKey="label"- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}interval={Math.max(0, Math.floor(data.length / 12))}/><YAxisyAxisId="weight"- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}domain={['dataMin - 5', 'dataMax + 5']}/>{hasBodyFat && (<YAxisyAxisId="pct"orientation="right"- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}domain={[0, 50]}/>)}@@ -95,7 +97,7 @@ export default function BodyCompChart() {type="monotone"dataKey="weight"name="Weight (lbs)"- stroke="#3b82f6"+ stroke={chartColors.accent}dot={false}strokeWidth={2}connectNulls@@ -106,7 +108,7 @@ export default function BodyCompChart() {type="monotone"dataKey="fatPct"name="Body Fat %"- stroke="#ef4444"+ stroke={chartColors.error}dot={false}strokeWidth={2}connectNullsdiff --git a/client/src/components/meatspace/EpigeneticTracker.jsx b/client/src/components/meatspace/EpigeneticTracker.jsxindex ef78d9ac64..66968e582a 100644--- a/client/src/components/meatspace/EpigeneticTracker.jsx+++ b/client/src/components/meatspace/EpigeneticTracker.jsx@@ -14,9 +14,9 @@ const CATEGORY_ICONS = {};const EVIDENCE_COLORS = {- strong: 'bg-green-500/20 text-green-400 border-green-500/30',- moderate: 'bg-yellow-500/20 text-yellow-400 border-yellow-500/30',- emerging: 'bg-blue-500/20 text-blue-400 border-blue-500/30'+ strong: 'bg-port-success/20 text-port-success border-port-success/30',+ moderate: 'bg-port-warning/20 text-port-warning border-port-warning/30',+ emerging: 'bg-port-accent/20 text-port-accent border-port-accent/30'};export default function EpigeneticTracker({ markerCategories = [] }) {@@ -213,8 +213,8 @@ export default function EpigeneticTracker({ markerCategories = [] }) {<div className="flex-1 h-1.5 bg-port-bg rounded-full overflow-hidden"><divclassName={`h-full rounded-full transition-all ${- s.compliance >= 0.8 ? 'bg-green-500' :- s.compliance >= 0.5 ? 'bg-yellow-500' : 'bg-red-500'+ s.compliance >= 0.8 ? 'bg-port-success' :+ s.compliance >= 0.5 ? 'bg-port-warning' : 'bg-port-error'}`}style={{ width: `${Math.round(s.compliance * 100)}%` }}/>@@ -247,7 +247,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {onClick={() => setExpandedTracked(prev => ({ ...prev, [key]: !prev[key] }))}className="w-full flex items-center gap-3 p-3 text-left hover:bg-white/5 transition-colors">- <Icon size={16} className={intervention.active ? 'text-green-400' : 'text-gray-600'} />+ <Icon size={16} className={intervention.active ? 'text-port-success' : 'text-gray-600'} /><span className={`text-sm font-medium flex-1 ${intervention.active ? 'text-white' : 'text-gray-500'}`}>{intervention.name}</span>@@ -276,7 +276,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {<buttononClick={() => handleLog(key)}disabled={loggingId === key}- className="flex items-center gap-1 px-3 py-1.5 bg-green-500/20 text-green-400 border border-green-500/30 rounded text-sm hover:bg-green-500/30 disabled:opacity-50"+ className="flex items-center gap-1 px-3 py-1.5 bg-port-success/20 text-port-success border border-port-success/30 rounded text-sm hover:bg-port-success/30 disabled:opacity-50">{loggingId === key ? <BrailleSpinner /> : <CheckCircle size={12} />}Log Today@@ -292,7 +292,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {<divkey={log.id}title={`${log.date}: ${log.amount} ${log.unit}`}- className="w-6 h-6 rounded bg-green-500/20 border border-green-500/30 flex items-center justify-center text-[10px] text-green-400 font-mono"+ className="w-6 h-6 rounded bg-port-success/20 border border-port-success/30 flex items-center justify-center text-[10px] text-port-success font-mono">{log.amount}</div>@@ -321,7 +321,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {) : (<buttononClick={() => requestDelete(key)}- className="px-2 py-1 bg-red-500/10 border border-red-500/20 rounded text-red-400 hover:bg-red-500/20"+ className="px-2 py-1 bg-port-error/10 border border-port-error/20 rounded text-port-error hover:bg-port-error/20"><Trash2 size={12} /></button>@@ -354,7 +354,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {onClick={() => setExpandedRecs(prev => ({ ...prev, [rec.id]: !prev[rec.id] }))}className="w-full flex items-center gap-3 p-3 text-left hover:bg-white/5 transition-colors">- <Icon size={16} className="text-purple-400" />+ <Icon size={16} className="text-port-accent-2" /><span className="text-sm font-medium text-white flex-1">{rec.name}</span><span className={`px-1.5 py-0.5 rounded text-xs border ${EVIDENCE_COLORS[rec.evidenceLevel] || EVIDENCE_COLORS.emerging}`}>{rec.evidenceLevel}@@ -377,7 +377,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {</div><div><span className="text-gray-500">Targets: </span>- <span className="text-purple-400">{rec.targetMarkers.join(', ')}</span>+ <span className="text-port-accent-2">{rec.targetMarkers.join(', ')}</span></div></div>@@ -391,7 +391,7 @@ export default function EpigeneticTracker({ markerCategories = [] }) {<buttononClick={() => handleAddCurated(rec)}- className="flex items-center gap-1.5 px-3 py-1.5 bg-purple-500/20 text-purple-400 border border-purple-500/30 rounded text-sm hover:bg-purple-500/30"+ className="flex items-center gap-1.5 px-3 py-1.5 bg-port-accent-2/20 text-port-accent-2 border border-port-accent-2/30 rounded text-sm hover:bg-port-accent-2/30"><Plus size={14} />Start Trackingdiff --git a/client/src/components/meatspace/NicotineChart.jsx b/client/src/components/meatspace/NicotineChart.jsxindex 3132781c2b..b1ea87a023 100644--- a/client/src/components/meatspace/NicotineChart.jsx+++ b/client/src/components/meatspace/NicotineChart.jsx@@ -4,6 +4,7 @@ import {} from 'recharts';import * as api from '../../services/api';import BrailleSpinner from '../BrailleSpinner';+import useChartColors from '../../hooks/useChartColors.js';import { localDateStr } from './constants';const VIEWS = [@@ -26,6 +27,7 @@ const CustomTooltip = ({ active, payload, label }) => {};export default function NicotineChart({ onRefreshKey, onViewChange }) {+ const chartColors = useChartColors();const [data, setData] = useState([]);const [loading, setLoading] = useState(true);const [view, setView] = useState('30d');@@ -96,18 +98,18 @@ export default function NicotineChart({ onRefreshKey, onViewChange }) {) : (<ResponsiveContainer width="100%" height={250}><BarChart data={data} margin={{ top: 5, right: 5, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} /><XAxisdataKey="label"- tick={{ fill: '#6b7280', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}interval={view === '7d' ? 0 : view === '30d' ? 2 : 6}/>- <YAxis tick={{ fill: '#6b7280', fontSize: 11 }} label={{ value: 'mg', angle: -90, position: 'insideLeft', fill: '#6b7280', fontSize: 10 }} />+ <YAxis tick={{ fill: chartColors.axis, fontSize: 11 }} label={{ value: 'mg', angle: -90, position: 'insideLeft', fill: chartColors.axis, fontSize: 10 }} /><Tooltip content={<CustomTooltip />} /><BardataKey="mg"radius={[2, 2, 0, 0]}- fill="#9ca3af"+ fill={chartColors.axis}maxBarSize={view === '7d' ? 40 : view === '30d' ? 16 : 8}/></BarChart>diff --git a/client/src/components/meatspace/NicotineHealthCorrelation.jsx b/client/src/components/meatspace/NicotineHealthCorrelation.jsxindex c2f474f1bb..23c27c7cc2 100644--- a/client/src/components/meatspace/NicotineHealthCorrelation.jsx+++ b/client/src/components/meatspace/NicotineHealthCorrelation.jsx@@ -2,6 +2,7 @@ import { HeartPulse, Cigarette } from 'lucide-react';import {ComposedChart, Line, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';+import useChartColors from '../../hooks/useChartColors.js';const CustomTooltip = ({ active, payload, label }) => {if (!active || !payload?.length) return null;@@ -37,6 +38,7 @@ function computeSummary(dailyData) {}export default function NicotineHealthCorrelation({ data, range }) {+ const chartColors = useChartColors();const dailyData = data?.dailyData ?? [];if (dailyData.length < 14) {@@ -74,30 +76,30 @@ export default function NicotineHealthCorrelation({ data, range }) {<ResponsiveContainer width="100%" height={220}><ComposedChart data={chartData} margin={{ top: 5, right: 40, bottom: 5, left: 0 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />- <XAxis dataKey="date" tick={{ fill: '#9ca3af', fontSize: 11 }} interval="preserveStartEnd" />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} />+ <XAxis dataKey="date" tick={{ fill: chartColors.axis, fontSize: 11 }} interval="preserveStartEnd" /><YAxisyAxisId="hr"orientation="left"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={40}- label={{ value: 'HR (bpm)', angle: -90, position: 'insideLeft', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'HR (bpm)', angle: -90, position: 'insideLeft', fill: chartColors.axis, fontSize: 10 }}/><YAxisyAxisId="nicotine"orientation="right"- tick={{ fill: '#9ca3af', fontSize: 11 }}+ tick={{ fill: chartColors.axis, fontSize: 11 }}width={40}- label={{ value: 'Nicotine (mg)', angle: 90, position: 'insideRight', fill: '#9ca3af', fontSize: 10 }}+ label={{ value: 'Nicotine (mg)', angle: 90, position: 'insideRight', fill: chartColors.axis, fontSize: 10 }}/><Tooltip content={<CustomTooltip />} />- <Legend wrapperStyle={{ fontSize: 11, color: '#9ca3af' }} />+ <Legend wrapperStyle={{ fontSize: 11, color: chartColors.axis }} /><LineyAxisId="hr"type="monotone"dataKey="hr"name="Heart Rate"- stroke="#ef4444"+ stroke={chartColors.error}strokeWidth={2}dot={false}connectNulls@@ -107,6 +109,8 @@ export default function NicotineHealthCorrelation({ data, range }) {type="monotone"dataKey="restingHr"name="Resting HR"+ // Lighter red than chartColors.error — deliberately distinct from+ // the primary HR line, no matching --port-* token.stroke="#f87171"strokeWidth={1}strokeDasharray="4 2"@@ -117,7 +121,7 @@ export default function NicotineHealthCorrelation({ data, range }) {yAxisId="nicotine"dataKey="nicotine"name="Nicotine"- fill="#9ca3af"+ fill={chartColors.axis}opacity={0.7}maxBarSize={12}/>diff --git a/client/src/components/meatspace/SleepCard.jsx b/client/src/components/meatspace/SleepCard.jsxindex a6a2ed79b1..68a47bcb77 100644--- a/client/src/components/meatspace/SleepCard.jsx+++ b/client/src/components/meatspace/SleepCard.jsx@@ -1,19 +1,13 @@import {BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer} from 'recharts';+import useChartColors from '../../hooks/useChartColors.js';-const STAGE_COLORS = {- deep: '#3b82f6',- rem: '#8b5cf6',- core: '#06b6d4',- awake: '#6b7280'-};--const CustomTooltip = ({ active, payload, label }) => {+const CustomTooltip = ({ active, payload, label, colors }) => {if (!active || !payload?.length) return null;return (- <div style={{ background: '#1a1a1a', border: '1px solid #2a2a2a', color: '#fff', padding: '8px', borderRadius: '6px', fontSize: '12px' }}>- <p style={{ color: '#9ca3af', marginBottom: 4 }}>{label}</p>+ <div style={{ background: colors.tooltipBg, border: `1px solid ${colors.tooltipBorder}`, color: colors.text, padding: '8px', borderRadius: '6px', fontSize: '12px' }}>+ <p style={{ color: colors.axis, marginBottom: 4 }}>{label}</p>{payload.map((entry) => (<p key={entry.dataKey} style={{ color: entry.fill, margin: '2px 0' }}>{entry.name}: {entry.value != null ? entry.value.toFixed(1) : '—'}h@@ -24,6 +18,13 @@ const CustomTooltip = ({ active, payload, label }) => {};export default function SleepCard({ data = [], loading = false }) {+ const chartColors = useChartColors();+ const stageColors = {+ deep: chartColors.chart1,+ rem: chartColors.chart2,+ core: chartColors.chart3,+ awake: chartColors.axis+ };const avg = data.length > 0? (data.reduce((sum, d) => sum + (d.totalSleep ?? d.value ?? 0), 0) / data.length): null;@@ -55,15 +56,15 @@ export default function SleepCard({ data = [], loading = false }) {{hasStages ? (<ResponsiveContainer width="100%" height={150}><BarChart data={last7} layout="vertical" margin={{ top: 2, right: 8, bottom: 2, left: 16 }}>- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" horizontal={false} />- <XAxis type="number" tick={{ fill: '#9ca3af', fontSize: 11 }} unit="h" />- <YAxis type="category" dataKey="date" tick={{ fill: '#9ca3af', fontSize: 10 }} width={36} />- <Tooltip content={<CustomTooltip />} />- <Legend wrapperStyle={{ fontSize: 10, color: '#9ca3af' }} />- <Bar dataKey="deep" name="Deep" stackId="a" fill={STAGE_COLORS.deep} />- <Bar dataKey="rem" name="REM" stackId="a" fill={STAGE_COLORS.rem} />- <Bar dataKey="core" name="Core" stackId="a" fill={STAGE_COLORS.core} />- <Bar dataKey="awake" name="Awake" stackId="a" fill={STAGE_COLORS.awake} />+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} horizontal={false} />+ <XAxis type="number" tick={{ fill: chartColors.axis, fontSize: 11 }} unit="h" />+ <YAxis type="category" dataKey="date" tick={{ fill: chartColors.axis, fontSize: 10 }} width={36} />+ <Tooltip content={<CustomTooltip colors={chartColors} />} />+ <Legend wrapperStyle={{ fontSize: 10, color: chartColors.axis }} />+ <Bar dataKey="deep" name="Deep" stackId="a" fill={stageColors.deep} />+ <Bar dataKey="rem" name="REM" stackId="a" fill={stageColors.rem} />+ <Bar dataKey="core" name="Core" stackId="a" fill={stageColors.core} />+ <Bar dataKey="awake" name="Awake" stackId="a" fill={stageColors.awake} /></BarChart></ResponsiveContainer>) : (diff --git a/client/src/components/meatspace/post/PostHistory.jsx b/client/src/components/meatspace/post/PostHistory.jsxindex 05539abd87..43d71e6856 100644--- a/client/src/components/meatspace/post/PostHistory.jsx+++ b/client/src/components/meatspace/post/PostHistory.jsx@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import { ArrowLeft, ChevronDown, ChevronRight } from 'lucide-react';import { LineChart, Line, XAxis, YAxis, Tooltip, ResponsiveContainer, CartesianGrid } from 'recharts';import { getPostSessions, getPostStats } from '../../../services/api';+import useChartColors from '../../../hooks/useChartColors.js';import { LLM_DRILL_TYPES, DRILL_LABELS } from './constants';const RANGES = [@@ -12,6 +13,7 @@ const RANGES = [];export default function PostHistory({ onBack }) {+ const chartColors = useChartColors();const [sessions, setSessions] = useState([]);const [stats, setStats] = useState(null);const [range, setRange] = useState(30);@@ -94,14 +96,14 @@ export default function PostHistory({ onBack }) {<h3 className="text-sm font-medium text-gray-400 mb-3">Score Trend</h3><ResponsiveContainer width="100%" height={200}><LineChart data={chartData}>- <CartesianGrid stroke="#2a2a2a" strokeDasharray="3 3" />- <XAxis dataKey="date" tick={{ fontSize: 11, fill: '#666' }} />- <YAxis domain={[0, 100]} tick={{ fontSize: 11, fill: '#666' }} />+ <CartesianGrid stroke={chartColors.grid} strokeDasharray="3 3" />+ <XAxis dataKey="date" tick={{ fontSize: 11, fill: chartColors.axis }} />+ <YAxis domain={[0, 100]} tick={{ fontSize: 11, fill: chartColors.axis }} /><Tooltip- contentStyle={{ backgroundColor: '#1a1a1a', border: '1px solid #2a2a2a', borderRadius: 8 }}- labelStyle={{ color: '#999' }}+ contentStyle={{ backgroundColor: chartColors.tooltipBg, border: `1px solid ${chartColors.tooltipBorder}`, borderRadius: 8 }}+ labelStyle={{ color: chartColors.axis }}/>- <Line type="monotone" dataKey="score" stroke="#3b82f6" strokeWidth={2} dot={{ r: 3 }} />+ <Line type="monotone" dataKey="score" stroke={chartColors.accent} strokeWidth={2} dot={{ r: 3 }} /></LineChart></ResponsiveContainer></div>diff --git a/client/src/index.css b/client/src/index.cssindex 35a5b8398f..28cfe50edd 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -5,12 +5,17 @@--color-port-card: rgb(var(--port-card));--color-port-border: rgb(var(--port-border));--color-port-accent: rgb(var(--port-accent));+ /* Secondary accent — purple/violet semantic home for AI-generated,+ recommendation, and other "secondary emphasis" content that previously+ had no theme token (issue #1909). Tuned per-theme in portosThemes.js. */+ --color-port-accent-2: rgb(var(--port-accent-2));--color-port-success: rgb(var(--port-success));--color-port-warning: rgb(var(--port-warning));--color-port-error: rgb(var(--port-error));--color-port-text: rgb(var(--port-text));--color-port-text-muted: rgb(var(--port-text-muted));--color-port-on-accent: rgb(var(--port-on-accent));+ --color-port-on-accent-2: rgb(var(--port-on-accent-2));--color-port-on-success: rgb(var(--port-on-success));--color-port-on-warning: rgb(var(--port-on-warning));--color-port-on-error: rgb(var(--port-on-error));@@ -24,10 +29,12 @@--port-card: 26 26 26;--port-border: 42 42 42;--port-accent: 59 130 246;+ --port-accent-2: 168 85 247;--port-success: 34 197 94;--port-warning: 245 158 11;--port-error: 239 68 68;--port-on-accent: 255 255 255;+ --port-on-accent-2: 255 255 255;--port-on-success: 5 46 22;--port-on-warning: 17 24 39;--port-on-error: 255 255 255;diff --git a/client/src/pages/ChiefOfStaff.jsx b/client/src/pages/ChiefOfStaff.jsxindex f6198e2875..de5e45c817 100644--- a/client/src/pages/ChiefOfStaff.jsx+++ b/client/src/pages/ChiefOfStaff.jsx@@ -462,7 +462,7 @@ export default function ChiefOfStaff() {<Brain className={`w-4 h-4 shrink-0 ${learningSummary?.status === 'critical' ? 'text-port-error' :learningSummary?.status === 'warning' ? 'text-port-warning' :- learningSummary?.status === 'good' ? 'text-purple-400' :+ learningSummary?.status === 'good' ? 'text-port-accent-2' :'text-gray-500'}`} /><div className="flex-1 min-w-0 text-left">@@ -776,7 +776,7 @@ export default function ChiefOfStaff() {className={`bg-port-card border rounded p-1.5 sm:p-2 lg:p-3 transition-all text-left hover:bg-port-card/80 ${learningSummary?.status === 'critical' ? 'border-port-error shadow-md shadow-port-error/20' :learningSummary?.status === 'warning' ? 'border-port-warning shadow-md shadow-port-warning/20' :- 'border-port-border hover:border-purple-500/50'+ 'border-port-border hover:border-port-accent-2/50'}`}title={learningSummary?.statusMessage || 'View learning analytics'}>@@ -785,7 +785,7 @@ export default function ChiefOfStaff() {<Brain className={`w-3 h-3 sm:w-4 sm:h-4 lg:w-5 lg:h-5 shrink-0 ${learningSummary?.status === 'critical' ? 'text-port-error' :learningSummary?.status === 'warning' ? 'text-port-warning' :- learningSummary?.status === 'good' ? 'text-purple-400' :+ learningSummary?.status === 'good' ? 'text-port-accent-2' :'text-gray-500'}`} /></div>diff --git a/client/src/themes/portosThemes.js b/client/src/themes/portosThemes.jsindex d8aba9594f..08de11f388 100644--- a/client/src/themes/portosThemes.js+++ b/client/src/themes/portosThemes.js@@ -12,6 +12,16 @@ const baseStatusColors = {'--port-on-error': '255 255 255',};+// Secondary accent — a semantic home for the "purple/violet" highlight used+// throughout the app for AI-generated / recommendation / secondary-emphasis+// content (issue #1909). Every theme defines its own value tuned to its+// palette (see each theme's `colors` block below); this default only covers+// any future theme that forgets to set one explicitly.+const DEFAULT_ACCENT2 = {+ '--port-accent-2': '168 85 247',+ '--port-on-accent-2': '255 255 255',+};+const baseMotionTokens = {'--port-motion-fast': '120ms','--port-motion-medium': '220ms',@@ -50,6 +60,7 @@ export const THEMES = {'--port-focus-ring': '59 130 246','--port-on-accent': '255 255 255',...baseStatusColors,+ ...DEFAULT_ACCENT2,},tokens: {...classicShapeTokens,@@ -119,6 +130,10 @@ export const THEMES = {'--port-warning': '180 83 9','--port-on-warning': '255 255 255','--port-error': '220 38 38',+ // violet-700 — darkened from the night theme's violet-500 for AA contrast+ // on the white card background.+ '--port-accent-2': '109 40 217',+ '--port-on-accent-2': '255 255 255',},tokens: {...classicShapeTokens,@@ -183,6 +198,10 @@ export const THEMES = {'--port-on-success': '6 43 24','--port-on-warning': '55 37 5','--port-on-error': '69 10 24',+ // violet-400 — a glass-panel-friendly secondary highlight distinct from+ // the cyan accent and rose error.+ '--port-accent-2': '192 132 252',+ '--port-on-accent-2': '37 7 56','--port-text': '236 253 255','--port-text-muted': '160 190 202','--port-control-text': '220 247 252',@@ -254,6 +273,9 @@ export const THEMES = {'--port-on-success': '5 46 22','--port-on-warning': '255 255 255','--port-on-error': '255 255 255',+ // violet-700 — darkened for AA contrast on the cream/white glass panels.+ '--port-accent-2': '126 34 206',+ '--port-on-accent-2': '255 255 255','--port-text': '12 30 36','--port-text-muted': '78 102 110','--port-control-text': '36 60 70',@@ -326,6 +348,10 @@ export const THEMES = {'--port-on-success': '0 28 12','--port-on-warning': '26 20 0','--port-on-error': '255 255 255',+ // Neon violet — distinct from the neon-green accent and magenta chart-2,+ // matching the cyberpunk palette's saturation.+ '--port-accent-2': '178 102 255',+ '--port-on-accent-2': '20 0 38','--port-text': '218 255 238','--port-text-muted': '112 166 139','--port-control-text': '207 255 230',@@ -399,6 +425,9 @@ export const THEMES = {'--port-on-success': '255 255 255','--port-on-warning': '255 255 255','--port-on-error': '255 255 255',+ // Plum ink — readable on cream paper, distinct from the rose error ink.+ '--port-accent-2': '106 27 154',+ '--port-on-accent-2': '255 255 255','--port-text': '14 56 36','--port-text-muted': '76 110 86','--port-control-text': '20 70 46',@@ -473,6 +502,9 @@ export const THEMES = {'--port-on-success': '6 36 27','--port-on-warning': '38 24 3','--port-on-error': '52 8 8',+ // Indigo — fits the schematic blueprint palette alongside the blue accent.+ '--port-accent-2': '129 140 248',+ '--port-on-accent-2': '17 19 46','--port-text': '239 246 255','--port-text-muted': '156 178 204','--port-control-text': '224 236 251',@@ -544,6 +576,9 @@ export const THEMES = {'--port-on-success': '255 255 255','--port-on-warning': '255 255 255','--port-on-error': '255 255 255',+ // Indigo-700 — darkened for AA contrast on white drafting paper.+ '--port-accent-2': '67 56 202',+ '--port-on-accent-2': '255 255 255','--port-text': '11 23 50','--port-text-muted': '71 85 105','--port-control-text': '23 37 84',