Spaces:
Sleeping
Add Light (Paper) and GMU (Mason) themes, runtime-switchable
Browse filesGroundwork:
* Colors migrated from hard-coded hex in tailwind.config.js to CSS
variables (RGB triplets so `/<alpha-value>` slash syntax still
works, e.g. `bg-canvas/80` -> `rgb(var(--color-canvas) / 0.8)`).
* React Flow overrides and MiniMap/Background colors in FlowCanvas
now read from the same variables, so theme swaps carry through
to the canvas widgets too.
* Body background gradient, scrollbar thumb, and edge-stroke color
are per-theme via --body-bg, --scrollbar-thumb, --rf-edge-stroke.
Themes registered in src/lib/theme.ts:
* dark -> :root default (deep navy + cyan — unchanged)
* light -> white paper background, deep sky/violet/pink/emerald
accents. Good for slides / screenshots / print.
* gmu -> Mason green canvas + Mason gold primary (#FFC72C),
green secondary (#006633), teal/red algo accents.
UI: ThemeSwitcher dropdown in TopBar (next to the Tour button),
shows preview swatches and tagline, persists pick to
`localStorage["jqub.theme"]`. A tiny pre-hydration script in
index.html applies the stored theme before React mounts to avoid
a dark-flash on first paint for non-default users.
Known gap: the SVG illustrations inside WelcomeTour still use
hard-coded hex; they'll look slightly off-brand in Light/GMU but
don't break. Can migrate later if needed.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- frontend/index.html +12 -0
- frontend/src/components/FlowCanvas.tsx +13 -11
- frontend/src/components/ThemeSwitcher.tsx +120 -0
- frontend/src/components/TopBar.tsx +2 -0
- frontend/src/index.css +100 -19
- frontend/src/lib/theme.ts +81 -0
- frontend/tailwind.config.js +20 -15
|
@@ -13,6 +13,18 @@
|
|
| 13 |
/>
|
| 14 |
</head>
|
| 15 |
<body class="bg-canvas text-ink font-sans antialiased">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<div id="root"></div>
|
| 17 |
<script type="module" src="/src/main.tsx"></script>
|
| 18 |
</body>
|
|
|
|
| 13 |
/>
|
| 14 |
</head>
|
| 15 |
<body class="bg-canvas text-ink font-sans antialiased">
|
| 16 |
+
<!-- Apply stored theme before first paint to avoid a dark→light flash
|
| 17 |
+
on initial load for users with non-default themes. -->
|
| 18 |
+
<script>
|
| 19 |
+
(function () {
|
| 20 |
+
try {
|
| 21 |
+
var t = localStorage.getItem("jqub.theme");
|
| 22 |
+
if (t === "light" || t === "gmu") {
|
| 23 |
+
document.documentElement.dataset.theme = t;
|
| 24 |
+
}
|
| 25 |
+
} catch (_) { /* ignore */ }
|
| 26 |
+
})();
|
| 27 |
+
</script>
|
| 28 |
<div id="root"></div>
|
| 29 |
<script type="module" src="/src/main.tsx"></script>
|
| 30 |
</body>
|
|
@@ -187,7 +187,7 @@ export function FlowCanvas() {
|
|
| 187 |
variant={BackgroundVariant.Dots}
|
| 188 |
gap={24}
|
| 189 |
size={1}
|
| 190 |
-
color="
|
| 191 |
/>
|
| 192 |
<Controls showInteractive={false} />
|
| 193 |
<MiniMap
|
|
@@ -197,7 +197,7 @@ export function FlowCanvas() {
|
|
| 197 |
const kind = (n.data as QNodeData).kind;
|
| 198 |
return colorForKind(kind);
|
| 199 |
}}
|
| 200 |
-
maskColor="
|
| 201 |
/>
|
| 202 |
</ReactFlow>
|
| 203 |
{nodes.length === 0 && <EmptyCanvas />}
|
|
@@ -269,18 +269,20 @@ function PresetPicker({ onPick }: { onPick: (key: string) => void }) {
|
|
| 269 |
);
|
| 270 |
}
|
| 271 |
|
|
|
|
|
|
|
| 272 |
function colorForKind(kind: NodeKind): string {
|
| 273 |
const map: Record<NodeKind, string> = {
|
| 274 |
-
input_circuit: "
|
| 275 |
-
fake_backend: "
|
| 276 |
-
ibm_backend: "
|
| 277 |
-
qucad: "
|
| 278 |
-
qubound: "
|
| 279 |
-
compvqc: "
|
| 280 |
-
fidelity: "
|
| 281 |
-
output: "
|
| 282 |
};
|
| 283 |
-
return map[kind] ?? "
|
| 284 |
}
|
| 285 |
|
| 286 |
function EmptyCanvas() {
|
|
|
|
| 187 |
variant={BackgroundVariant.Dots}
|
| 188 |
gap={24}
|
| 189 |
size={1}
|
| 190 |
+
color="rgb(var(--color-edge))"
|
| 191 |
/>
|
| 192 |
<Controls showInteractive={false} />
|
| 193 |
<MiniMap
|
|
|
|
| 197 |
const kind = (n.data as QNodeData).kind;
|
| 198 |
return colorForKind(kind);
|
| 199 |
}}
|
| 200 |
+
maskColor="rgb(var(--color-canvas) / 0.65)"
|
| 201 |
/>
|
| 202 |
</ReactFlow>
|
| 203 |
{nodes.length === 0 && <EmptyCanvas />}
|
|
|
|
| 269 |
);
|
| 270 |
}
|
| 271 |
|
| 272 |
+
// MiniMap node colors keyed to theme variables so they shift alongside the
|
| 273 |
+
// rest of the palette instead of clashing in light or GMU themes.
|
| 274 |
function colorForKind(kind: NodeKind): string {
|
| 275 |
const map: Record<NodeKind, string> = {
|
| 276 |
+
input_circuit: "rgb(var(--color-accent))",
|
| 277 |
+
fake_backend: "rgb(var(--color-accent))",
|
| 278 |
+
ibm_backend: "rgb(var(--color-warn))",
|
| 279 |
+
qucad: "rgb(var(--color-accent2))",
|
| 280 |
+
qubound: "rgb(var(--color-accent3))",
|
| 281 |
+
compvqc: "rgb(var(--color-accent4))",
|
| 282 |
+
fidelity: "rgb(var(--color-ok))",
|
| 283 |
+
output: "rgb(var(--color-ink))",
|
| 284 |
};
|
| 285 |
+
return map[kind] ?? "rgb(var(--color-mute))";
|
| 286 |
}
|
| 287 |
|
| 288 |
function EmptyCanvas() {
|
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { useEffect, useRef, useState } from "react";
|
| 2 |
+
import { Check, Palette } from "lucide-react";
|
| 3 |
+
import {
|
| 4 |
+
THEMES,
|
| 5 |
+
applyTheme,
|
| 6 |
+
loadStoredTheme,
|
| 7 |
+
storeTheme,
|
| 8 |
+
type ThemeKey,
|
| 9 |
+
} from "../lib/theme";
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* TopBar theme switcher.
|
| 13 |
+
*
|
| 14 |
+
* - Applies the stored theme on mount (before first paint the attribute is
|
| 15 |
+
* already set by the pre-hydration inline script in index.html, so this
|
| 16 |
+
* effect is only a no-op reconcile in the happy path).
|
| 17 |
+
* - Dropdown lists all registered themes with a preview swatch and
|
| 18 |
+
* tagline; selection immediately flips the `<html data-theme>` attribute
|
| 19 |
+
* and persists to localStorage.
|
| 20 |
+
*/
|
| 21 |
+
export function ThemeSwitcher() {
|
| 22 |
+
const [theme, setTheme] = useState<ThemeKey>(() => loadStoredTheme());
|
| 23 |
+
const [open, setOpen] = useState(false);
|
| 24 |
+
const rootRef = useRef<HTMLDivElement>(null);
|
| 25 |
+
|
| 26 |
+
// Keep DOM in sync with React state — covers both the initial mount
|
| 27 |
+
// (in case the pre-hydration script is missing) and any later change.
|
| 28 |
+
useEffect(() => {
|
| 29 |
+
applyTheme(theme);
|
| 30 |
+
storeTheme(theme);
|
| 31 |
+
}, [theme]);
|
| 32 |
+
|
| 33 |
+
// Close the menu on outside-click / Escape.
|
| 34 |
+
useEffect(() => {
|
| 35 |
+
if (!open) return;
|
| 36 |
+
const onDoc = (e: MouseEvent) => {
|
| 37 |
+
if (!rootRef.current?.contains(e.target as globalThis.Node)) {
|
| 38 |
+
setOpen(false);
|
| 39 |
+
}
|
| 40 |
+
};
|
| 41 |
+
const onKey = (e: KeyboardEvent) => {
|
| 42 |
+
if (e.key === "Escape") setOpen(false);
|
| 43 |
+
};
|
| 44 |
+
document.addEventListener("mousedown", onDoc);
|
| 45 |
+
document.addEventListener("keydown", onKey);
|
| 46 |
+
return () => {
|
| 47 |
+
document.removeEventListener("mousedown", onDoc);
|
| 48 |
+
document.removeEventListener("keydown", onKey);
|
| 49 |
+
};
|
| 50 |
+
}, [open]);
|
| 51 |
+
|
| 52 |
+
return (
|
| 53 |
+
<div ref={rootRef} className="relative">
|
| 54 |
+
<button
|
| 55 |
+
type="button"
|
| 56 |
+
onClick={() => setOpen((v) => !v)}
|
| 57 |
+
className="btn-ghost"
|
| 58 |
+
title="Switch color theme"
|
| 59 |
+
aria-label="Switch color theme"
|
| 60 |
+
aria-haspopup="menu"
|
| 61 |
+
aria-expanded={open}
|
| 62 |
+
>
|
| 63 |
+
<Palette className="w-3.5 h-3.5" />
|
| 64 |
+
<span className="hidden sm:inline">Theme</span>
|
| 65 |
+
</button>
|
| 66 |
+
{open && (
|
| 67 |
+
<div
|
| 68 |
+
role="menu"
|
| 69 |
+
className="absolute right-0 top-full mt-1 rounded-lg border border-edge bg-surface shadow-xl z-30 p-2 flex flex-col gap-1 w-[230px]"
|
| 70 |
+
>
|
| 71 |
+
{THEMES.map((t) => {
|
| 72 |
+
const active = t.key === theme;
|
| 73 |
+
return (
|
| 74 |
+
<button
|
| 75 |
+
key={t.key}
|
| 76 |
+
type="button"
|
| 77 |
+
role="menuitemradio"
|
| 78 |
+
aria-checked={active}
|
| 79 |
+
onClick={() => {
|
| 80 |
+
setTheme(t.key);
|
| 81 |
+
setOpen(false);
|
| 82 |
+
}}
|
| 83 |
+
className={`flex items-center gap-2 px-2 py-1.5 rounded-md text-left transition-colors ${
|
| 84 |
+
active
|
| 85 |
+
? "bg-surfaceAlt border border-accent/40"
|
| 86 |
+
: "border border-transparent hover:bg-surfaceAlt hover:border-edge/60"
|
| 87 |
+
}`}
|
| 88 |
+
>
|
| 89 |
+
<span
|
| 90 |
+
className="shrink-0 inline-flex rounded-md overflow-hidden border border-edge/60"
|
| 91 |
+
aria-hidden="true"
|
| 92 |
+
>
|
| 93 |
+
<span
|
| 94 |
+
className="w-3 h-5"
|
| 95 |
+
style={{ background: t.swatch[0] }}
|
| 96 |
+
/>
|
| 97 |
+
<span
|
| 98 |
+
className="w-3 h-5"
|
| 99 |
+
style={{ background: t.swatch[1] }}
|
| 100 |
+
/>
|
| 101 |
+
</span>
|
| 102 |
+
<span className="min-w-0 flex-1">
|
| 103 |
+
<span className="block text-sm text-ink leading-tight">
|
| 104 |
+
{t.label}
|
| 105 |
+
</span>
|
| 106 |
+
<span className="block text-[11px] text-mute leading-tight truncate">
|
| 107 |
+
{t.tagline}
|
| 108 |
+
</span>
|
| 109 |
+
</span>
|
| 110 |
+
{active && (
|
| 111 |
+
<Check className="w-3.5 h-3.5 text-accent shrink-0" />
|
| 112 |
+
)}
|
| 113 |
+
</button>
|
| 114 |
+
);
|
| 115 |
+
})}
|
| 116 |
+
</div>
|
| 117 |
+
)}
|
| 118 |
+
</div>
|
| 119 |
+
);
|
| 120 |
+
}
|
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import { useApp } from "../lib/store";
|
| 2 |
import { Activity, HelpCircle, Zap } from "lucide-react";
|
|
|
|
| 3 |
|
| 4 |
export function TopBar({ onOpenTour }: { onOpenTour?: () => void }) {
|
| 5 |
const health = useApp((s) => s.health);
|
|
@@ -67,6 +68,7 @@ export function TopBar({ onOpenTour }: { onOpenTour?: () => void }) {
|
|
| 67 |
>
|
| 68 |
{chipLabel}
|
| 69 |
</button>
|
|
|
|
| 70 |
{onOpenTour && (
|
| 71 |
<button
|
| 72 |
onClick={onOpenTour}
|
|
|
|
| 1 |
import { useApp } from "../lib/store";
|
| 2 |
import { Activity, HelpCircle, Zap } from "lucide-react";
|
| 3 |
+
import { ThemeSwitcher } from "./ThemeSwitcher";
|
| 4 |
|
| 5 |
export function TopBar({ onOpenTour }: { onOpenTour?: () => void }) {
|
| 6 |
const health = useApp((s) => s.health);
|
|
|
|
| 68 |
>
|
| 69 |
{chipLabel}
|
| 70 |
</button>
|
| 71 |
+
<ThemeSwitcher />
|
| 72 |
{onOpenTour && (
|
| 73 |
<button
|
| 74 |
onClick={onOpenTour}
|
|
@@ -2,24 +2,104 @@
|
|
| 2 |
@tailwind components;
|
| 3 |
@tailwind utilities;
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
@layer base {
|
| 6 |
:root {
|
| 7 |
color-scheme: dark;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
html, body, #root {
|
| 10 |
height: 100%;
|
| 11 |
}
|
| 12 |
body {
|
| 13 |
-
background:
|
| 14 |
-
radial-gradient(1000px 500px at 0% 110%, rgba(76,201,240,0.10), transparent 70%),
|
| 15 |
-
#0b1020;
|
| 16 |
}
|
| 17 |
*::-webkit-scrollbar {
|
| 18 |
width: 10px;
|
| 19 |
height: 10px;
|
| 20 |
}
|
| 21 |
*::-webkit-scrollbar-thumb {
|
| 22 |
-
background:
|
| 23 |
border-radius: 5px;
|
| 24 |
}
|
| 25 |
*::-webkit-scrollbar-track {
|
|
@@ -56,7 +136,8 @@
|
|
| 56 |
}
|
| 57 |
}
|
| 58 |
|
| 59 |
-
/* React Flow
|
|
|
|
| 60 |
.react-flow__background {
|
| 61 |
background-color: transparent;
|
| 62 |
}
|
|
@@ -64,43 +145,43 @@
|
|
| 64 |
cursor: default;
|
| 65 |
}
|
| 66 |
.react-flow__edge-path {
|
| 67 |
-
stroke:
|
| 68 |
stroke-width: 1.5;
|
| 69 |
}
|
| 70 |
.react-flow__edge.selected .react-flow__edge-path {
|
| 71 |
-
stroke:
|
| 72 |
}
|
| 73 |
.react-flow__arrowhead {
|
| 74 |
-
fill:
|
| 75 |
}
|
| 76 |
.react-flow__handle {
|
| 77 |
-
background:
|
| 78 |
-
border: 2px solid
|
| 79 |
width: 10px;
|
| 80 |
height: 10px;
|
| 81 |
}
|
| 82 |
.react-flow__controls {
|
| 83 |
-
background:
|
| 84 |
-
border: 1px solid
|
| 85 |
border-radius: 8px;
|
| 86 |
overflow: hidden;
|
| 87 |
}
|
| 88 |
.react-flow__controls-button {
|
| 89 |
background: transparent !important;
|
| 90 |
-
color:
|
| 91 |
-
border-bottom: 1px solid
|
| 92 |
}
|
| 93 |
.react-flow__controls-button:hover {
|
| 94 |
-
background:
|
| 95 |
-
color:
|
| 96 |
}
|
| 97 |
.react-flow__minimap {
|
| 98 |
-
background:
|
| 99 |
-
border: 1px solid
|
| 100 |
border-radius: 8px !important;
|
| 101 |
}
|
| 102 |
.react-flow__attribution {
|
| 103 |
background: transparent !important;
|
| 104 |
-
color:
|
| 105 |
font-size: 10px !important;
|
| 106 |
}
|
|
|
|
| 2 |
@tailwind components;
|
| 3 |
@tailwind utilities;
|
| 4 |
|
| 5 |
+
/* ============================================================
|
| 6 |
+
* Theme tokens
|
| 7 |
+
*
|
| 8 |
+
* Default is "dark" (the original navy + cyan palette).
|
| 9 |
+
* data-theme="light" : paper-style white background, deep accents
|
| 10 |
+
* data-theme="gmu" : GMU Mason green canvas + Mason gold primary
|
| 11 |
+
*
|
| 12 |
+
* Values are `R G B` triplets so Tailwind's `/ <alpha-value>` syntax
|
| 13 |
+
* works uniformly: `bg-canvas/80` → rgb(var(--color-canvas) / 0.8).
|
| 14 |
+
* ============================================================ */
|
| 15 |
@layer base {
|
| 16 |
:root {
|
| 17 |
color-scheme: dark;
|
| 18 |
+
/* DARK (default) */
|
| 19 |
+
--color-canvas: 11 16 32;
|
| 20 |
+
--color-surface: 17 24 48;
|
| 21 |
+
--color-surfaceAlt: 21 29 56;
|
| 22 |
+
--color-edge: 31 42 74;
|
| 23 |
+
--color-mute: 132 146 199;
|
| 24 |
+
--color-ink: 230 235 255;
|
| 25 |
+
--color-accent: 76 201 240;
|
| 26 |
+
--color-accent2: 123 92 255;
|
| 27 |
+
--color-accent3: 247 37 133;
|
| 28 |
+
--color-accent4: 6 214 160;
|
| 29 |
+
--color-warn: 244 162 97;
|
| 30 |
+
--color-danger: 239 71 111;
|
| 31 |
+
--color-ok: 45 212 191;
|
| 32 |
+
/* Body bg gradient and scrollbar colors are theme-specific too */
|
| 33 |
+
--body-bg:
|
| 34 |
+
radial-gradient(1200px 600px at 80% -10%, rgb(123 92 255 / 0.12), transparent 70%),
|
| 35 |
+
radial-gradient(1000px 500px at 0% 110%, rgb(76 201 240 / 0.10), transparent 70%),
|
| 36 |
+
rgb(var(--color-canvas));
|
| 37 |
+
--scrollbar-thumb: rgb(var(--color-edge));
|
| 38 |
+
--rf-edge-stroke: 74 90 138; /* #4a5a8a */
|
| 39 |
+
--rf-edge-selected: var(--color-accent);
|
| 40 |
}
|
| 41 |
+
|
| 42 |
+
[data-theme="light"] {
|
| 43 |
+
color-scheme: light;
|
| 44 |
+
--color-canvas: 246 247 251;
|
| 45 |
+
--color-surface: 255 255 255;
|
| 46 |
+
--color-surfaceAlt: 240 243 249;
|
| 47 |
+
--color-edge: 216 222 232;
|
| 48 |
+
--color-mute: 100 116 139;
|
| 49 |
+
--color-ink: 15 23 42;
|
| 50 |
+
--color-accent: 2 132 199;
|
| 51 |
+
--color-accent2: 124 58 237;
|
| 52 |
+
--color-accent3: 219 39 119;
|
| 53 |
+
--color-accent4: 5 150 105;
|
| 54 |
+
--color-warn: 217 119 6;
|
| 55 |
+
--color-danger: 220 38 38;
|
| 56 |
+
--color-ok: 5 150 105;
|
| 57 |
+
--body-bg:
|
| 58 |
+
radial-gradient(1200px 600px at 80% -10%, rgb(124 58 237 / 0.08), transparent 70%),
|
| 59 |
+
radial-gradient(1000px 500px at 0% 110%, rgb(2 132 199 / 0.08), transparent 70%),
|
| 60 |
+
rgb(var(--color-canvas));
|
| 61 |
+
--scrollbar-thumb: rgb(var(--color-edge));
|
| 62 |
+
--rf-edge-stroke: 148 163 184; /* slate-400 */
|
| 63 |
+
--rf-edge-selected: var(--color-accent);
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
[data-theme="gmu"] {
|
| 67 |
+
color-scheme: dark;
|
| 68 |
+
/* Mason Green canvas + Mason Gold primary accent */
|
| 69 |
+
--color-canvas: 10 24 18;
|
| 70 |
+
--color-surface: 19 46 31;
|
| 71 |
+
--color-surfaceAlt: 26 61 40;
|
| 72 |
+
--color-edge: 43 89 57;
|
| 73 |
+
--color-mute: 137 178 154;
|
| 74 |
+
--color-ink: 255 248 225;
|
| 75 |
+
--color-accent: 255 199 44; /* Mason Gold #FFC72C */
|
| 76 |
+
--color-accent2: 0 163 81; /* bright Mason Green */
|
| 77 |
+
--color-accent3: 232 74 95; /* warm contrast red */
|
| 78 |
+
--color-accent4: 109 195 213; /* soft Patriot teal */
|
| 79 |
+
--color-warn: 255 152 0;
|
| 80 |
+
--color-danger: 229 57 53;
|
| 81 |
+
--color-ok: 0 200 83;
|
| 82 |
+
--body-bg:
|
| 83 |
+
radial-gradient(1200px 600px at 80% -10%, rgb(255 199 44 / 0.10), transparent 70%),
|
| 84 |
+
radial-gradient(1000px 500px at 0% 110%, rgb(0 102 51 / 0.14), transparent 70%),
|
| 85 |
+
rgb(var(--color-canvas));
|
| 86 |
+
--scrollbar-thumb: rgb(var(--color-edge));
|
| 87 |
+
--rf-edge-stroke: 90 130 100;
|
| 88 |
+
--rf-edge-selected: var(--color-accent);
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
html, body, #root {
|
| 92 |
height: 100%;
|
| 93 |
}
|
| 94 |
body {
|
| 95 |
+
background: var(--body-bg);
|
|
|
|
|
|
|
| 96 |
}
|
| 97 |
*::-webkit-scrollbar {
|
| 98 |
width: 10px;
|
| 99 |
height: 10px;
|
| 100 |
}
|
| 101 |
*::-webkit-scrollbar-thumb {
|
| 102 |
+
background: var(--scrollbar-thumb);
|
| 103 |
border-radius: 5px;
|
| 104 |
}
|
| 105 |
*::-webkit-scrollbar-track {
|
|
|
|
| 136 |
}
|
| 137 |
}
|
| 138 |
|
| 139 |
+
/* React Flow overrides — read from theme variables so colors travel with
|
| 140 |
+
the active theme. Hex values used to be hard-coded here. */
|
| 141 |
.react-flow__background {
|
| 142 |
background-color: transparent;
|
| 143 |
}
|
|
|
|
| 145 |
cursor: default;
|
| 146 |
}
|
| 147 |
.react-flow__edge-path {
|
| 148 |
+
stroke: rgb(var(--rf-edge-stroke));
|
| 149 |
stroke-width: 1.5;
|
| 150 |
}
|
| 151 |
.react-flow__edge.selected .react-flow__edge-path {
|
| 152 |
+
stroke: rgb(var(--color-accent));
|
| 153 |
}
|
| 154 |
.react-flow__arrowhead {
|
| 155 |
+
fill: rgb(var(--rf-edge-stroke));
|
| 156 |
}
|
| 157 |
.react-flow__handle {
|
| 158 |
+
background: rgb(var(--color-accent));
|
| 159 |
+
border: 2px solid rgb(var(--color-canvas));
|
| 160 |
width: 10px;
|
| 161 |
height: 10px;
|
| 162 |
}
|
| 163 |
.react-flow__controls {
|
| 164 |
+
background: rgb(var(--color-surfaceAlt));
|
| 165 |
+
border: 1px solid rgb(var(--color-edge));
|
| 166 |
border-radius: 8px;
|
| 167 |
overflow: hidden;
|
| 168 |
}
|
| 169 |
.react-flow__controls-button {
|
| 170 |
background: transparent !important;
|
| 171 |
+
color: rgb(var(--color-mute)) !important;
|
| 172 |
+
border-bottom: 1px solid rgb(var(--color-edge)) !important;
|
| 173 |
}
|
| 174 |
.react-flow__controls-button:hover {
|
| 175 |
+
background: rgb(var(--color-edge)) !important;
|
| 176 |
+
color: rgb(var(--color-ink)) !important;
|
| 177 |
}
|
| 178 |
.react-flow__minimap {
|
| 179 |
+
background: rgb(var(--color-surfaceAlt)) !important;
|
| 180 |
+
border: 1px solid rgb(var(--color-edge)) !important;
|
| 181 |
border-radius: 8px !important;
|
| 182 |
}
|
| 183 |
.react-flow__attribution {
|
| 184 |
background: transparent !important;
|
| 185 |
+
color: rgb(var(--rf-edge-stroke)) !important;
|
| 186 |
font-size: 10px !important;
|
| 187 |
}
|
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/**
|
| 2 |
+
* Theme registry + persistence.
|
| 3 |
+
*
|
| 4 |
+
* Theme tokens are defined as CSS variables in index.css under
|
| 5 |
+
* `:root` (dark), `[data-theme="light"]`, and `[data-theme="gmu"]`.
|
| 6 |
+
* This module is responsible for picking which of those is active
|
| 7 |
+
* at runtime by writing to `document.documentElement.dataset.theme`,
|
| 8 |
+
* and for persisting the user's choice across page loads.
|
| 9 |
+
*/
|
| 10 |
+
|
| 11 |
+
export type ThemeKey = "dark" | "light" | "gmu";
|
| 12 |
+
|
| 13 |
+
export interface ThemeSpec {
|
| 14 |
+
key: ThemeKey;
|
| 15 |
+
label: string;
|
| 16 |
+
/** One-line tagline shown in the switcher menu. */
|
| 17 |
+
tagline: string;
|
| 18 |
+
/** Two sample swatches shown as a preview chip. */
|
| 19 |
+
swatch: [string, string];
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
export const THEMES: ThemeSpec[] = [
|
| 23 |
+
{
|
| 24 |
+
key: "dark",
|
| 25 |
+
label: "Midnight",
|
| 26 |
+
tagline: "Deep navy · electric cyan",
|
| 27 |
+
swatch: ["#0b1020", "#4cc9f0"],
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
key: "light",
|
| 31 |
+
label: "Paper",
|
| 32 |
+
tagline: "White background · print-ready",
|
| 33 |
+
swatch: ["#f6f7fb", "#0284c7"],
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
key: "gmu",
|
| 37 |
+
label: "GMU Mason",
|
| 38 |
+
tagline: "Mason green · Mason gold",
|
| 39 |
+
swatch: ["#0a1812", "#FFC72C"],
|
| 40 |
+
},
|
| 41 |
+
];
|
| 42 |
+
|
| 43 |
+
export const THEME_BY_KEY: Record<ThemeKey, ThemeSpec> = Object.fromEntries(
|
| 44 |
+
THEMES.map((t) => [t.key, t]),
|
| 45 |
+
) as Record<ThemeKey, ThemeSpec>;
|
| 46 |
+
|
| 47 |
+
export const DEFAULT_THEME: ThemeKey = "dark";
|
| 48 |
+
const LS_THEME = "jqub.theme";
|
| 49 |
+
|
| 50 |
+
export function loadStoredTheme(): ThemeKey {
|
| 51 |
+
if (typeof window === "undefined") return DEFAULT_THEME;
|
| 52 |
+
try {
|
| 53 |
+
const raw = window.localStorage.getItem(LS_THEME);
|
| 54 |
+
if (raw && (raw === "dark" || raw === "light" || raw === "gmu")) {
|
| 55 |
+
return raw;
|
| 56 |
+
}
|
| 57 |
+
} catch {
|
| 58 |
+
/* ignore */
|
| 59 |
+
}
|
| 60 |
+
return DEFAULT_THEME;
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
export function applyTheme(theme: ThemeKey): void {
|
| 64 |
+
if (typeof document === "undefined") return;
|
| 65 |
+
// Dark is the :root default, so clear the attribute instead of setting
|
| 66 |
+
// it. Avoids an extra CSS selector lookup and keeps inspector clean.
|
| 67 |
+
if (theme === "dark") {
|
| 68 |
+
delete document.documentElement.dataset.theme;
|
| 69 |
+
} else {
|
| 70 |
+
document.documentElement.dataset.theme = theme;
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
export function storeTheme(theme: ThemeKey): void {
|
| 75 |
+
if (typeof window === "undefined") return;
|
| 76 |
+
try {
|
| 77 |
+
window.localStorage.setItem(LS_THEME, theme);
|
| 78 |
+
} catch {
|
| 79 |
+
/* ignore quota / disabled storage */
|
| 80 |
+
}
|
| 81 |
+
}
|
|
@@ -1,4 +1,10 @@
|
|
| 1 |
/** @type {import('tailwindcss').Config} */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
export default {
|
| 3 |
content: ["./index.html", "./src/**/*.{ts,tsx}"],
|
| 4 |
theme: {
|
|
@@ -8,23 +14,22 @@ export default {
|
|
| 8 |
mono: ['JetBrains Mono', 'ui-monospace', 'monospace'],
|
| 9 |
},
|
| 10 |
colors: {
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
ok: "#2dd4bf",
|
| 25 |
},
|
| 26 |
boxShadow: {
|
| 27 |
-
glow: "0 0 0 1px
|
| 28 |
card: "0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 30px -10px rgba(0,0,0,0.55)",
|
| 29 |
},
|
| 30 |
},
|
|
|
|
| 1 |
/** @type {import('tailwindcss').Config} */
|
| 2 |
+
// Color tokens are CSS variables so themes can swap them at runtime without
|
| 3 |
+
// re-building Tailwind. The variable values are `R G B` triplets (no commas,
|
| 4 |
+
// no rgb() wrapper) so Tailwind's `/ <alpha-value>` slash syntax still works
|
| 5 |
+
// — e.g. `bg-canvas/80` compiles to `rgb(var(--color-canvas) / 0.8)`.
|
| 6 |
+
// Default (dark) values live in `index.css :root`; `[data-theme="light"]`
|
| 7 |
+
// and `[data-theme="gmu"]` override them.
|
| 8 |
export default {
|
| 9 |
content: ["./index.html", "./src/**/*.{ts,tsx}"],
|
| 10 |
theme: {
|
|
|
|
| 14 |
mono: ['JetBrains Mono', 'ui-monospace', 'monospace'],
|
| 15 |
},
|
| 16 |
colors: {
|
| 17 |
+
canvas: "rgb(var(--color-canvas) / <alpha-value>)",
|
| 18 |
+
surface: "rgb(var(--color-surface) / <alpha-value>)",
|
| 19 |
+
surfaceAlt: "rgb(var(--color-surfaceAlt) / <alpha-value>)",
|
| 20 |
+
edge: "rgb(var(--color-edge) / <alpha-value>)",
|
| 21 |
+
mute: "rgb(var(--color-mute) / <alpha-value>)",
|
| 22 |
+
ink: "rgb(var(--color-ink) / <alpha-value>)",
|
| 23 |
+
accent: "rgb(var(--color-accent) / <alpha-value>)",
|
| 24 |
+
accent2: "rgb(var(--color-accent2) / <alpha-value>)",
|
| 25 |
+
accent3: "rgb(var(--color-accent3) / <alpha-value>)",
|
| 26 |
+
accent4: "rgb(var(--color-accent4) / <alpha-value>)",
|
| 27 |
+
warn: "rgb(var(--color-warn) / <alpha-value>)",
|
| 28 |
+
danger: "rgb(var(--color-danger) / <alpha-value>)",
|
| 29 |
+
ok: "rgb(var(--color-ok) / <alpha-value>)",
|
|
|
|
| 30 |
},
|
| 31 |
boxShadow: {
|
| 32 |
+
glow: "0 0 0 1px rgb(var(--color-accent) / 0.35), 0 8px 24px -6px rgb(var(--color-accent) / 0.25)",
|
| 33 |
card: "0 1px 0 rgba(255,255,255,0.04) inset, 0 10px 30px -10px rgba(0,0,0,0.55)",
|
| 34 |
},
|
| 35 |
},
|