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

refactor([issue-1851]): make hover/chart/panel colors follow the active theme

[._.]/ Adam Eivy5c2042608416
diff --git a/client/src/components/apps/tabs/DocumentsTab.jsx b/client/src/components/apps/tabs/DocumentsTab.jsx
index 6b19064424..b84ff5c78c 100644
--- a/client/src/components/apps/tabs/DocumentsTab.jsx
+++ b/client/src/components/apps/tabs/DocumentsTab.jsx
@@ -193,7 +193,7 @@ export default function DocumentsTab({ appId, repoPath }) {
<textarea
value={editContent}
onChange={e => setEditContent(e.target.value)}
- className="w-full h-[500px] bg-[#0d0d0d] text-gray-200 border border-port-border rounded-lg p-3 font-mono text-sm resize-y focus:outline-hidden focus:border-port-accent/50"
+ className="w-full h-[500px] bg-[var(--port-terminal-bg)] text-gray-200 border border-port-border rounded-lg p-3 font-mono text-sm resize-y focus:outline-hidden focus:border-port-accent/50"
spellCheck={false}
/>
</div>
diff --git a/client/src/components/cos/TerminalCoSPanel.jsx b/client/src/components/cos/TerminalCoSPanel.jsx
index cd394ca649..a5d9845929 100644
--- a/client/src/components/cos/TerminalCoSPanel.jsx
+++ b/client/src/components/cos/TerminalCoSPanel.jsx
@@ -83,7 +83,7 @@ export default function TerminalCoSPanel({ state, speaking, statusMessage, event
};
return (
- <div className="relative flex flex-col p-3 lg:p-4 font-mono text-sm bg-[#0d1117] border-b lg:border-b-0 lg:border-r border-gray-700/50 shrink-0 lg:h-full overflow-hidden lg:overflow-y-auto scrollbar-hide max-h-[50vh] lg:max-h-none">
+ <div className="relative flex flex-col p-3 lg:p-4 font-mono text-sm bg-[var(--port-terminal-bg)] border-b lg:border-b-0 lg:border-r border-gray-700/50 shrink-0 lg:h-full overflow-hidden lg:overflow-y-auto scrollbar-hide max-h-[50vh] lg:max-h-none">
{/* Scanline effect */}
<div
className="absolute inset-0 pointer-events-none opacity-[0.02]"
diff --git a/client/src/components/digital-twin/tabs/GoalsTab.jsx b/client/src/components/digital-twin/tabs/GoalsTab.jsx
index fc156c14a0..6a23dc1a85 100644
--- a/client/src/components/digital-twin/tabs/GoalsTab.jsx
+++ b/client/src/components/digital-twin/tabs/GoalsTab.jsx
@@ -168,7 +168,7 @@ export default function GoalsTab({ onRefresh }) {
/>
<button
onClick={handleSetBirthDate}
- className="px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-blue-600"
+ className="px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80"
>
Save
</button>
@@ -258,7 +258,7 @@ export default function GoalsTab({ onRefresh }) {
</div>
<button
onClick={() => setShowNewGoal(!showNewGoal)}
- className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-blue-600"
+ className="flex items-center gap-1.5 px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80"
>
<Plus className="w-4 h-4" />
Add Goal
@@ -312,7 +312,7 @@ export default function GoalsTab({ onRefresh }) {
<button
onClick={handleCreateGoal}
disabled={!newGoal.title.trim()}
- className="px-4 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-blue-600 disabled:opacity-50"
+ className="px-4 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50"
>
Create
</button>
diff --git a/client/src/components/goals/GoalEditForm.jsx b/client/src/components/goals/GoalEditForm.jsx
index 5fa5a6d984..4c8e94f661 100644
--- a/client/src/components/goals/GoalEditForm.jsx
+++ b/client/src/components/goals/GoalEditForm.jsx
@@ -167,7 +167,7 @@ export default function GoalEditForm({
</div>
</div>
<div className="flex gap-2">
- <button onClick={saveEdit} className="px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-blue-600">
+ <button onClick={saveEdit} className="px-3 py-1.5 text-sm rounded bg-port-accent text-white hover:bg-port-accent/80">
Save
</button>
<button onClick={onCancel} className="px-3 py-1.5 text-sm rounded bg-port-border text-gray-300">
diff --git a/client/src/components/goals/GoalPlanSection.jsx b/client/src/components/goals/GoalPlanSection.jsx
index 69f8e9cbcd..8349dce60a 100644
--- a/client/src/components/goals/GoalPlanSection.jsx
+++ b/client/src/components/goals/GoalPlanSection.jsx
@@ -114,14 +114,14 @@ export default function GoalPlanSection({
))}
<button
onClick={() => setProposedPhases([...proposedPhases, { title: '', description: '', targetDate: goal.targetDate, order: proposedPhases.length }])}
- className="text-xs text-port-accent hover:text-blue-300 flex items-center gap-1"
+ className="text-xs text-port-accent hover:text-port-accent/80 flex items-center gap-1"
>
<Plus className="w-3 h-3" /> Add phase
</button>
<div className="flex gap-2">
<button
onClick={handleAcceptPhases}
- className="px-3 py-1.5 text-xs rounded bg-port-accent text-white hover:bg-blue-600"
+ className="px-3 py-1.5 text-xs rounded bg-port-accent text-white hover:bg-port-accent/80"
>
Accept Plan
</button>
@@ -236,7 +236,7 @@ export default function GoalPlanSection({
<div className="flex gap-2">
<button
onClick={handleAcceptDecomposition}
- className="px-3 py-1.5 text-xs rounded bg-port-accent text-white hover:bg-blue-600"
+ className="px-3 py-1.5 text-xs rounded bg-port-accent text-white hover:bg-port-accent/80"
>
Accept Tasks
</button>
diff --git a/client/src/components/goals/GoalsTreeView.jsx b/client/src/components/goals/GoalsTreeView.jsx
index c787d3be81..c8afe7c747 100644
--- a/client/src/components/goals/GoalsTreeView.jsx
+++ b/client/src/components/goals/GoalsTreeView.jsx
@@ -225,7 +225,7 @@ function OrganizePanel({ suggestion, goals, onApply, onClose, applying }) {
<button
onClick={onApply}
disabled={applying}
- className="flex-1 flex items-center justify-center gap-1.5 px-3 py-2 text-sm rounded-lg bg-port-accent text-white hover:bg-blue-600 disabled:opacity-50 min-h-[40px]"
+ className="flex-1 flex items-center justify-center gap-1.5 px-3 py-2 text-sm rounded-lg bg-port-accent text-white hover:bg-port-accent/80 disabled:opacity-50 min-h-[40px]"
>
<Check className="w-4 h-4" />
{applying ? 'Applying...' : 'Apply Changes'}
diff --git a/client/src/components/gsd/GsdDocumentsPanel.jsx b/client/src/components/gsd/GsdDocumentsPanel.jsx
index 234cde987d..af30ab3d5e 100644
--- a/client/src/components/gsd/GsdDocumentsPanel.jsx
+++ b/client/src/components/gsd/GsdDocumentsPanel.jsx
@@ -115,7 +115,7 @@ export default function GsdDocumentsPanel({ appId, selectedDoc, onSelectDoc }) {
<textarea
value={editContent}
onChange={e => setEditContent(e.target.value)}
- className="w-full h-[500px] bg-[#0d0d0d] text-gray-200 border border-port-border rounded-lg p-3 font-mono text-sm resize-y focus:outline-hidden focus:border-port-accent/50"
+ className="w-full h-[500px] bg-[var(--port-terminal-bg)] text-gray-200 border border-port-border rounded-lg p-3 font-mono text-sm resize-y focus:outline-hidden focus:border-port-accent/50"
spellCheck={false}
/>
</div>
diff --git a/client/src/components/meatspace/AlcoholChart.jsx b/client/src/components/meatspace/AlcoholChart.jsx
index b5a7f89a73..ada8590444 100644
--- a/client/src/components/meatspace/AlcoholChart.jsx
+++ b/client/src/components/meatspace/AlcoholChart.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 = [
@@ -19,6 +20,7 @@ export default function AlcoholChart({ sex = 'male', onRefreshKey, onViewChange
const [loading, setLoading] = useState(true);
const [view, setView] = useState('30d');
const [unit, setUnit] = useState('grams'); // 'grams' or 'drinks'
+ const chartColors = useChartColors();
const dailyMax = sex === 'female' ? 1 : 2;
@@ -127,41 +129,41 @@ export default function AlcoholChart({ sex = 'male', 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} />
<XAxis
dataKey="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 }} />
+ <YAxis tick={{ fill: chartColors.axis, fontSize: 11 }} />
<Tooltip content={<CustomTooltip />} />
{unit === 'grams' ? (
<>
<ReferenceLine
y={10}
- stroke="#22c55e"
+ stroke={chartColors.success}
strokeDasharray="5 5"
- label={{ value: '10g target', fill: '#22c55e', fontSize: 10, position: 'right' }}
+ label={{ value: '10g target', fill: chartColors.success, fontSize: 10, position: 'right' }}
/>
<ReferenceLine
y={40}
- stroke="#ef4444"
+ stroke={chartColors.error}
strokeDasharray="5 5"
- label={{ value: '40g danger', fill: '#ef4444', fontSize: 10, position: 'right' }}
+ label={{ value: '40g danger', fill: chartColors.error, fontSize: 10, position: 'right' }}
/>
</>
) : (
<ReferenceLine
y={dailyMax}
- stroke="#f59e0b"
+ stroke={chartColors.warning}
strokeDasharray="5 5"
- label={{ value: 'Daily limit', fill: '#f59e0b', fontSize: 10, position: 'right' }}
+ label={{ value: 'Daily limit', fill: chartColors.warning, fontSize: 10, position: 'right' }}
/>
)}
<Bar
dataKey={dataKey}
radius={[2, 2, 0, 0]}
- fill="#3b82f6"
+ fill={chartColors.accent}
maxBarSize={view === '7d' ? 40 : view === '30d' ? 16 : 8}
/>
</BarChart>
diff --git a/client/src/components/meatspace/BloodPressureCard.jsx b/client/src/components/meatspace/BloodPressureCard.jsx
index f5f45603eb..a3626fbb31 100644
--- a/client/src/components/meatspace/BloodPressureCard.jsx
+++ b/client/src/components/meatspace/BloodPressureCard.jsx
@@ -89,7 +89,7 @@ export default function BloodPressureCard() {
{!showForm && (
<button
onClick={openForm}
- className="flex items-center gap-1 text-xs text-port-accent hover:text-blue-300 transition-colors"
+ className="flex items-center gap-1 text-xs text-port-accent hover:text-port-accent/80 transition-colors"
>
<Plus size={14} /> Add Reading
</button>
diff --git a/client/src/components/meatspace/MetricCard.jsx b/client/src/components/meatspace/MetricCard.jsx
index c4455bbea7..f0c1f3743a 100644
--- a/client/src/components/meatspace/MetricCard.jsx
+++ b/client/src/components/meatspace/MetricCard.jsx
@@ -1,9 +1,11 @@
import {
LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer
} from 'recharts';
+import useChartColors from '../../hooks/useChartColors.js';
export default function MetricCard({ data = [], loading = false, config, latestValue }) {
const { label, unit, color, aggregation, formatValue } = config;
+ const chartColors = useChartColors();
const isSumMetric = aggregation === 'sum';
const summary = data.length > 0
@@ -50,17 +52,17 @@ export default function MetricCard({ data = [], loading = false, config, latestV
</div>
<ResponsiveContainer width="100%" height={150}>
<LineChart data={chartData} margin={{ top: 2, right: 8, bottom: 2, left: 0 }}>
- <CartesianGrid strokeDasharray="3 3" stroke="#2a2a2a" />
- <XAxis dataKey="date" tick={{ fill: '#9ca3af', fontSize: 11 }} interval="preserveStartEnd" />
- <YAxis tick={{ fill: '#9ca3af', fontSize: 11 }} width={55} domain={['auto', 'auto']}
+ <CartesianGrid strokeDasharray="3 3" stroke={chartColors.grid} />
+ <XAxis dataKey="date" tick={{ fill: chartColors.axis, fontSize: 11 }} interval="preserveStartEnd" />
+ <YAxis tick={{ fill: chartColors.axis, fontSize: 11 }} width={55} domain={['auto', 'auto']}
tickFormatter={v => typeof v === 'number' && v >= 1000 ? v.toLocaleString() : v} />
<Tooltip content={({ active, payload, label: tipLabel }) => {
if (!active || !payload?.length) return null;
const val = payload[0].value;
const formatted = formatValue ? formatValue(val) : (typeof val === 'number' && val >= 1000 ? val.toLocaleString() : Math.round(val * 100) / 100);
return (
- <div style={{ background: '#1a1a1a', border: '1px solid #2a2a2a', color: '#fff', padding: '8px', borderRadius: '6px', fontSize: '12px' }}>
- <p style={{ color: '#9ca3af', marginBottom: 2 }}>{tipLabel}</p>
+ <div style={{ background: chartColors.tooltipBg, border: `1px solid ${chartColors.tooltipBorder}`, color: chartColors.text, padding: '8px', borderRadius: '6px', fontSize: '12px' }}>
+ <p style={{ color: chartColors.axis, marginBottom: 2 }}>{tipLabel}</p>
<p style={{ color, fontWeight: 600 }}>{formatted} {unit}</p>
</div>
);
diff --git a/client/src/components/meatspace/tabs/BodyTab.jsx b/client/src/components/meatspace/tabs/BodyTab.jsx
index acfc4586f0..6b057850f8 100644
--- a/client/src/components/meatspace/tabs/BodyTab.jsx
+++ b/client/src/components/meatspace/tabs/BodyTab.jsx
@@ -112,7 +112,7 @@ export default function BodyTab() {
{!showEyeForm && editingEyeIdx == null && (
<button
onClick={() => { setShowEyeForm(true); setEyeForm({ ...EMPTY_EYE_FORM, date: new Date().toISOString().split('T')[0] }); }}
- className="flex items-center gap-1 text-xs text-port-accent hover:text-blue-300 transition-colors"
+ className="flex items-center gap-1 text-xs text-port-accent hover:text-port-accent/80 transition-colors"
>
<Plus size={14} /> Add Exam
</button>
diff --git a/client/src/components/ui/ProseEditor.jsx b/client/src/components/ui/ProseEditor.jsx
index 644c8d6ba1..12dc1c993b 100644
--- a/client/src/components/ui/ProseEditor.jsx
+++ b/client/src/components/ui/ProseEditor.jsx
@@ -37,7 +37,7 @@ const ProseEditor = forwardRef(function ProseEditor({
// The light reading theme paints the textarea like paper; dark (default)
// inherits the surrounding surface, so no inline style is needed.
style={readingTheme === 'light'
- ? { '--port-input-bg': 'var(--wr-reading-paper)', color: '#1a1a1a' }
+ ? { '--port-input-bg': 'var(--wr-reading-paper)', color: 'var(--wr-reading-ink)' }
: undefined}
className={`font-serif leading-relaxed ${className}`.trim()}
{...rest}
diff --git a/client/src/hooks/README.md b/client/src/hooks/README.md
index 1adb77d13d..51d8675a51 100644
--- a/client/src/hooks/README.md
+++ b/client/src/hooks/README.md
@@ -81,6 +81,7 @@ grep -i "what you want to do" client/src/hooks/README.md
| `useArmedAction` | Two-click-arm `[armed, fire]` confirmation. | Destructive button needing a confirm tap. (Project memory: user finds this less discoverable — prefer inline confirm rows for new UI.) |
| `useAutoRefetch` | Poll-based refetch on an interval. `{ pollOnly: true }` skips internal data/loading state for side-effect-only callers (returns `{ refetch }` only). | Data needs periodic refresh (no socket / SSE available). |
| `useAutoSizeTextarea` | `[ref, resize]` — grows a `<textarea>` to fit its content (no scroll / hand-resize); recomputes before paint on value change. | A textarea that should auto-fit content. Prefer the `AutoSizeTextarea` UI component, which wraps this. |
+| `useChartColors` | Resolves the `--port-*` theme tokens (accent/success/warning/error, `chart-1..4`, grid, axis, tooltip surfaces) to concrete `rgb()` strings via `getComputedStyle`, re-resolving on theme switch. | A recharts card needs theme-following colors — SVG `fill`/`stroke` props can't read CSS vars, so pass these resolved strings instead of hardcoded hex. |
| `useClickOutside` | Fire `onOutside` on mousedown outside a ref. | Popovers, menus, drawers. |
| `useConfirmDelete` | Single-at-a-time `{ confirmingId, isConfirming, requestDelete, cancelDelete, confirmDelete }` for arming one list/card row at a time. | New destructive list action — pair with `<InlineConfirmRow>` / `<ConfirmButtonPair>` instead of deleting on the raw trash click. |
| `useEscapeKey` | `useEscapeKey(active, handler)` — call `handler` on Escape while `active`. | Non-modal dismissables (in-context popovers/cards); Modal owns Esc for true modals. |
diff --git a/client/src/hooks/index.js b/client/src/hooks/index.js
index 8f4cacc1e1..d22e5c2607 100644
--- a/client/src/hooks/index.js
+++ b/client/src/hooks/index.js
@@ -11,6 +11,8 @@
export { default as useAnchorReveal } from './useAnchorReveal.js';
export { default as useCityAudio } from './useCityAudio.js';
export { default as useAutoSizeTextarea } from './useAutoSizeTextarea.js';
+export { default as useChartColors } from './useChartColors.js';
+export * from './useChartColors.js';
export { default as useClickOutside } from './useClickOutside.js';
export { default as useConfirmDelete } from './useConfirmDelete.js';
export { default as useColorMatch } from './useColorMatch.js';
diff --git a/client/src/hooks/useChartColors.js b/client/src/hooks/useChartColors.js
new file mode 100644
index 0000000000..8a32131152
--- /dev/null
+++ b/client/src/hooks/useChartColors.js
@@ -0,0 +1,79 @@
+import { useState, useEffect } from 'react';
+
+// recharts renders colors as SVG presentation attributes (fill/stroke), which
+// cannot read CSS custom properties — `stroke="var(--port-accent)"` is ignored
+// by the SVG renderer. This hook resolves the `--port-*` theme tokens to
+// concrete color strings via getComputedStyle so chart cards follow the active
+// theme instead of hardcoding hex values, and re-resolves when the theme
+// switches (useTheme sets `data-port-theme` on <html>).
+
+// Theme tokens are stored as space-separated RGB triples ("59 130 246").
+const CHART_VARS = {
+ accent: '--port-accent',
+ success: '--port-success',
+ warning: '--port-warning',
+ error: '--port-error',
+ chart1: '--port-chart-1',
+ chart2: '--port-chart-2',
+ chart3: '--port-chart-3',
+ chart4: '--port-chart-4',
+ grid: '--port-chart-grid',
+ axis: '--port-text-muted',
+ tooltipBg: '--port-card',
+ tooltipBorder: '--port-border',
+ text: '--port-text',
+};
+
+// Classic Midnight defaults — used in non-browser/test environments and when a
+// stylesheet hasn't applied the tokens yet, so charts still render sensibly.
+const FALLBACKS = {
+ accent: '#3b82f6',
+ success: '#22c55e',
+ warning: '#f59e0b',
+ error: '#ef4444',
+ chart1: '#3b82f6',
+ chart2: '#22c55e',
+ chart3: '#f59e0b',
+ chart4: '#ec4899',
+ grid: '#404040',
+ axis: '#a3a3a3',
+ tooltipBg: '#1a1a1a',
+ tooltipBorder: '#2a2a2a',
+ text: '#e5e5e5',
+};
+
+// "59 130 246" -> "rgb(59, 130, 246)". Comma form is the most broadly accepted
+// syntax for SVG presentation attributes. Returns the fallback for an empty or
+// malformed value.
+export const tripleToRgb = (triple, fallback) => {
+ const parts = (triple || '').trim().split(/\s+/).filter(Boolean);
+ if (parts.length < 3) return fallback;
+ return `rgb(${parts[0]}, ${parts[1]}, ${parts[2]})`;
+};
+
+const resolveChartColors = () => {
+ if (typeof window === 'undefined' || typeof getComputedStyle !== 'function') {
+ return { ...FALLBACKS };
+ }
+ const styles = getComputedStyle(document.documentElement);
+ const out = {};
+ for (const [key, varName] of Object.entries(CHART_VARS)) {
+ out[key] = tripleToRgb(styles.getPropertyValue(varName), FALLBACKS[key]);
+ }
+ return out;
+};
+
+export default function useChartColors() {
+ const [colors, setColors] = useState(resolveChartColors);
+
+ useEffect(() => {
+ setColors(resolveChartColors());
+ if (typeof MutationObserver !== 'function') return undefined;
+ const root = document.documentElement;
+ const observer = new MutationObserver(() => setColors(resolveChartColors()));
+ observer.observe(root, { attributes: true, attributeFilter: ['data-port-theme'] });
+ return () => observer.disconnect();
+ }, []);
+
+ return colors;
+}
diff --git a/client/src/hooks/useChartColors.test.jsx b/client/src/hooks/useChartColors.test.jsx
new file mode 100644
index 0000000000..4e1adb2cbd
--- /dev/null
+++ b/client/src/hooks/useChartColors.test.jsx
@@ -0,0 +1,61 @@
+import { describe, it, expect, afterEach, vi } from 'vitest';
+import { renderHook, act } from '@testing-library/react';
+import useChartColors, { tripleToRgb } from './useChartColors.js';
+
+afterEach(() => {
+ vi.restoreAllMocks();
+ document.documentElement.removeAttribute('style');
+ document.documentElement.removeAttribute('data-port-theme');
+});
+
+describe('tripleToRgb', () => {
+ it('converts a space-separated RGB triple to an rgb() string', () => {
+ expect(tripleToRgb('59 130 246', '#000')).toBe('rgb(59, 130, 246)');
+ });
+
+ it('tolerates leading/trailing/extra whitespace', () => {
+ expect(tripleToRgb(' 34 197 94 ', '#000')).toBe('rgb(34, 197, 94)');
+ });
+
+ it('falls back when the value is empty or malformed', () => {
+ expect(tripleToRgb('', '#fallback')).toBe('#fallback');
+ expect(tripleToRgb(' ', '#fallback')).toBe('#fallback');
+ expect(tripleToRgb('59 130', '#fallback')).toBe('#fallback');
+ expect(tripleToRgb(undefined, '#fallback')).toBe('#fallback');
+ });
+});
+
+describe('useChartColors', () => {
+ it('resolves --port-* tokens set on <html> into rgb() strings', () => {
+ const root = document.documentElement;
+ root.style.setProperty('--port-accent', '10 20 30');
+ root.style.setProperty('--port-chart-grid', '64 64 64');
+
+ const { result } = renderHook(() => useChartColors());
+ expect(result.current.accent).toBe('rgb(10, 20, 30)');
+ expect(result.current.grid).toBe('rgb(64, 64, 64)');
+ });
+
+ it('uses fallbacks when tokens are absent', () => {
+ const { result } = renderHook(() => useChartColors());
+ // No CSS vars applied in jsdom → classic-midnight fallbacks.
+ expect(result.current.accent).toBe('#3b82f6');
+ expect(result.current.error).toBe('#ef4444');
+ });
+
+ it('re-resolves when the theme dataset attribute changes', async () => {
+ const root = document.documentElement;
+ root.style.setProperty('--port-accent', '1 1 1');
+ const { result } = renderHook(() => useChartColors());
+ expect(result.current.accent).toBe('rgb(1, 1, 1)');
+
+ await act(async () => {
+ root.style.setProperty('--port-accent', '2 2 2');
+ root.setAttribute('data-port-theme', 'some-other-theme');
+ // Allow the MutationObserver microtask to flush.
+ await Promise.resolve();
+ });
+
+ expect(result.current.accent).toBe('rgb(2, 2, 2)');
+ });
+});
diff --git a/client/src/index.css b/client/src/index.css
index be0a06d32e..2fd903efa5 100644
--- a/client/src/index.css
+++ b/client/src/index.css
@@ -39,6 +39,10 @@
textarea, the AI panel's Evaluate/Format/Adapt result containers, and
the per-scene cards. Centralized so the shade can be tweaked once. */
--wr-reading-paper: #f5f1e8;
+ /* Ink color paired with the sepia reading paper above — dark text on light
+ paper, intentionally fixed (not app-theme-following) so it stays legible
+ regardless of the active theme. Centralized so the shade tweaks once. */
+ --wr-reading-ink: #1a1a1a;
--port-bg-alpha: 1;
--port-card-alpha: 1;
--port-border-alpha: 1;
diff --git a/client/src/pages/JiraReports.jsx b/client/src/pages/JiraReports.jsx
index e85e078d16..8f69e2c211 100644
--- a/client/src/pages/JiraReports.jsx
+++ b/client/src/pages/JiraReports.jsx
@@ -202,7 +202,7 @@ export default function JiraReports() {
<button
onClick={() => handleGenerate(filterAppId || null)}
disabled={generating}
- className="flex items-center gap-1.5 bg-port-accent hover:bg-blue-600 text-white text-sm px-3 py-1.5 rounded disabled:opacity-50"
+ className="flex items-center gap-1.5 bg-port-accent hover:bg-port-accent/80 text-white text-sm px-3 py-1.5 rounded disabled:opacity-50"
>
{generating ? <BrailleSpinner /> : <RefreshCw size={14} />}
{generating ? 'Generating...' : 'Generate Report'}
diff --git a/client/src/pages/Shell.jsx b/client/src/pages/Shell.jsx
index 67616751ef..859fd70429 100644
--- a/client/src/pages/Shell.jsx
+++ b/client/src/pages/Shell.jsx
@@ -97,7 +97,7 @@ function TerminalHotKeys({ sendCtrlC, handlePaste, sendNavKey, showPasteInput, s
</button>
<button
onClick={handlePaste}
- className="flex items-center gap-1.5 px-3 py-1.5 bg-port-accent/15 hover:bg-port-accent/25 text-port-accent hover:text-blue-300 rounded text-xs font-mono transition-colors border border-port-accent/30 min-h-[40px] shrink-0"
+ className="flex items-center gap-1.5 px-3 py-1.5 bg-port-accent/15 hover:bg-port-accent/25 text-port-accent hover:text-port-accent/80 rounded text-xs font-mono transition-colors border border-port-accent/30 min-h-[40px] shrink-0"
title="Paste clipboard contents"
aria-label="Paste clipboard contents"
>
diff --git a/client/src/pages/StoryBuilder.jsx b/client/src/pages/StoryBuilder.jsx
index 0bd73cec40..e79a18e67f 100644
--- a/client/src/pages/StoryBuilder.jsx
+++ b/client/src/pages/StoryBuilder.jsx
@@ -277,7 +277,7 @@ function StoryBuilderIndex() {
</div>
<button
onClick={create} disabled={creating}
- className="inline-flex items-center gap-2 bg-port-accent hover:bg-blue-600 disabled:opacity-50 text-white px-4 py-2 rounded"
+ className="inline-flex items-center gap-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 text-white px-4 py-2 rounded"
>
{creating ? <Loader2 className="w-4 h-4 animate-spin" /> : <Plus className="w-4 h-4" />}
Create &amp; begin
@@ -460,7 +460,7 @@ function ImportPanel({ onCreated }) {
{!preview ? (
<button onClick={analyze} disabled={analyzing}
- className="inline-flex items-center gap-2 bg-port-accent hover:bg-blue-600 disabled:opacity-50 text-white px-4 py-2 rounded">
+ className="inline-flex items-center gap-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 text-white px-4 py-2 rounded">
{analyzing ? <Loader2 className="w-4 h-4 animate-spin" /> : <Sparkles className="w-4 h-4" />}
{analyzing ? 'Analyzing… (this can take a minute)' : 'Analyze'}
</button>
@@ -771,7 +771,7 @@ function StepPanel({ session, universe, series, issues, stepId, locked, onChange
const genButton = (label = 'Generate with AI', hasContent = false) => (
<button
onClick={runGenerate} disabled={busy || locked}
- className="inline-flex items-center gap-2 bg-port-accent hover:bg-blue-600 disabled:opacity-50 text-white px-3 py-1.5 rounded text-sm"
+ className="inline-flex items-center gap-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 text-white px-3 py-1.5 rounded text-sm"
>
{isRunning('generate') ? <Loader2 className="w-4 h-4 animate-spin" /> : (hasContent ? <RefreshCw className="w-4 h-4" /> : <Sparkles className="w-4 h-4" />)}
{isRunning('generate') ? (phase || 'Working…') : (hasContent ? 'Re-generate' : label)}
@@ -1069,7 +1069,7 @@ function IssuesPanel({ session, series, issues, onChanged }) {
<button
onClick={generateIssues} disabled={generating}
title="Generate a per-episode breakdown for every season and create the issues here"
- className="inline-flex items-center gap-2 bg-port-accent hover:bg-blue-600 disabled:opacity-50 text-white px-3 py-1.5 rounded text-sm"
+ className="inline-flex items-center gap-2 bg-port-accent hover:bg-port-accent/80 disabled:opacity-50 text-white px-3 py-1.5 rounded text-sm"
>
{generating ? <Loader2 className="w-4 h-4 animate-spin" /> : <Sparkles className="w-4 h-4" />}
Generate issues from arc
@@ -1449,7 +1449,7 @@ function StoryBuilderDetail({ storyId, stepParam }) {
<button
onClick={() => goToStep(stepIds[activeIdx + 1])}
disabled={!stepState.locked || isStale}
- className="inline-flex items-center gap-1 text-sm bg-port-accent hover:bg-blue-600 disabled:opacity-40 text-white px-3 py-1.5 rounded"
+ className="inline-flex items-center gap-1 text-sm bg-port-accent hover:bg-port-accent/80 disabled:opacity-40 text-white px-3 py-1.5 rounded"
>
Next <ChevronRight className="w-4 h-4" />
</button>