TheYuchen commited on
Commit
ceee520
·
1 Parent(s): 5bd8443

Remove the GMU-branded theme entirely

Browse files

Double-blind treatment is no longer needed (reviewers see the paper,
not the site), and the branded palette was the last piece of identity
chrome with real maintenance cost: theme.ts gated it behind ANON,
vite.config.ts carried a CSS-stripping generateBundle hook, and every
new visual had to be checked under a third palette.

- theme.ts: ThemeKey is light|dark; gmu entry gone; stored "gmu"
preference migrates to the light default (comment documents it).
- index.css: [data-theme="gmu"] token block deleted.
- vite.config.ts: %THEME_KEYS% is always ["dark"]; the anon
CSS-stripping hook is retired (nothing left to strip). The rest of
the VITE_ANON machinery (titles, manifest) is unchanged.
- Stray "three themes" comments updated.

Residue grep: only the migration comment mentions the old key.

frontend/index.html CHANGED
@@ -42,8 +42,7 @@
42
  <!-- Apply stored theme before first paint so returning users who
43
  picked a non-default theme don't see a flash of the light
44
  default (the light theme IS the :root default, so it needs no
45
- attribute). %THEME_KEYS% is substituted in vite.config.ts —
46
- anonymous builds drop the university-branded theme key. -->
47
  <script>
48
  (function () {
49
  try {
 
42
  <!-- Apply stored theme before first paint so returning users who
43
  picked a non-default theme don't see a flash of the light
44
  default (the light theme IS the :root default, so it needs no
45
+ attribute). %THEME_KEYS% is substituted in vite.config.ts. -->
 
46
  <script>
47
  (function () {
48
  try {
frontend/src/components/TransformationSignature.tsx CHANGED
@@ -51,7 +51,7 @@
51
  //
52
  // All fills use currentColor driven by the theme token classes
53
  // (text-ok / text-warn / text-accent / text-mute), so the glyph
54
- // re-colors under all three themes (dark / light / GMU) for free.
55
  //
56
  // Two densities:
57
  // size="tile" — 46×14, no labels (tooltip carries numbers); for
 
51
  //
52
  // All fills use currentColor driven by the theme token classes
53
  // (text-ok / text-warn / text-accent / text-mute), so the glyph
54
+ // re-colors under both themes (dark / light) for free.
55
  //
56
  // Two densities:
57
  // size="tile" — 46×14, no labels (tooltip carries numbers); for
frontend/src/index.css CHANGED
@@ -9,7 +9,6 @@
9
  * so the app renders correctly even before any JS runs (no flash of
10
  * unthemed content on first paint, SSR-safe, accessibility-friendly).
11
  * data-theme="dark" : original navy + cyan palette
12
- * data-theme="gmu" : GMU Mason green canvas + Mason gold primary
13
  *
14
  * Values are `R G B` triplets so Tailwind's `/ <alpha-value>` syntax
15
  * works uniformly: `bg-canvas/80` → rgb(var(--color-canvas) / 0.8).
@@ -64,30 +63,6 @@
64
  --rf-edge-selected: var(--color-accent);
65
  }
66
 
67
- [data-theme="gmu"] {
68
- color-scheme: dark;
69
- /* Mason Green canvas + Mason Gold primary accent */
70
- --color-canvas: 10 24 18;
71
- --color-surface: 19 46 31;
72
- --color-surfaceAlt: 26 61 40;
73
- --color-edge: 43 89 57;
74
- --color-mute: 137 178 154;
75
- --color-ink: 255 248 225;
76
- --color-accent: 255 199 44; /* Mason Gold #FFC72C */
77
- --color-accent2: 0 163 81; /* bright Mason Green */
78
- --color-accent3: 232 74 95; /* warm contrast red */
79
- --color-accent4: 109 195 213; /* soft Patriot teal */
80
- --color-warn: 255 152 0;
81
- --color-danger: 229 57 53;
82
- --color-ok: 0 200 83;
83
- --body-bg:
84
- radial-gradient(1200px 600px at 80% -10%, rgb(255 199 44 / 0.10), transparent 70%),
85
- radial-gradient(1000px 500px at 0% 110%, rgb(0 102 51 / 0.14), transparent 70%),
86
- rgb(var(--color-canvas));
87
- --scrollbar-thumb: rgb(var(--color-edge));
88
- --rf-edge-stroke: 90 130 100;
89
- --rf-edge-selected: var(--color-accent);
90
- }
91
 
92
  html, body, #root {
93
  height: 100%;
 
9
  * so the app renders correctly even before any JS runs (no flash of
10
  * unthemed content on first paint, SSR-safe, accessibility-friendly).
11
  * data-theme="dark" : original navy + cyan palette
 
12
  *
13
  * Values are `R G B` triplets so Tailwind's `/ <alpha-value>` syntax
14
  * works uniformly: `bg-canvas/80` → rgb(var(--color-canvas) / 0.8).
 
63
  --rf-edge-selected: var(--color-accent);
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
  html, body, #root {
68
  height: 100%;
frontend/src/lib/autoConnect.ts CHANGED
@@ -285,7 +285,7 @@ export function autoConnect(
285
  ...(isNoiseSidechain && {
286
  label: "noise profile",
287
  // SVG `fill` accepts `rgb(var(--name))` so the label + background
288
- // follow the active theme (dark / light / GMU) automatically.
289
  labelStyle: { fontSize: 10, fill: "rgb(var(--color-mute))" },
290
  labelBgStyle: {
291
  fill: "rgb(var(--color-surface))",
 
285
  ...(isNoiseSidechain && {
286
  label: "noise profile",
287
  // SVG `fill` accepts `rgb(var(--name))` so the label + background
288
+ // follow the active theme (dark / light) automatically.
289
  labelStyle: { fontSize: 10, fill: "rgb(var(--color-mute))" },
290
  labelBgStyle: {
291
  fill: "rgb(var(--color-surface))",
frontend/src/lib/theme.ts CHANGED
@@ -2,16 +2,14 @@
2
  * Theme registry + persistence.
3
  *
4
  * Theme tokens are defined as CSS variables in index.css under
5
- * `:root` (light — the default), `[data-theme="dark"]`, and
6
- * `[data-theme="gmu"]`. This module is responsible for picking which of
7
- * those is active at runtime by writing to
8
  * `document.documentElement.dataset.theme`, and for persisting the
9
  * user's choice across page loads.
10
  */
11
 
12
- import { ANON } from "./anon";
13
-
14
- export type ThemeKey = "light" | "dark" | "gmu";
15
 
16
  export interface ThemeSpec {
17
  key: ThemeKey;
@@ -35,21 +33,6 @@ export const THEMES: ThemeSpec[] = [
35
  tagline: "Deep navy · electric cyan",
36
  swatch: ["#0b1020", "#4cc9f0"],
37
  },
38
- // The university-branded theme identifies the group, so it is gated
39
- // behind the double-anonymous flag. Spread-of-ternary on the
40
- // build-time constant → the branded strings are dead-code-eliminated
41
- // from a VITE_ANON=1 bundle entirely; the runtime flag hides the
42
- // entry (and the stored preference falls back to light below).
43
- ...(ANON
44
- ? []
45
- : ([
46
- {
47
- key: "gmu",
48
- label: "GMU Mason",
49
- tagline: "Mason green · Mason gold",
50
- swatch: ["#0a1812", "#FFC72C"],
51
- },
52
- ] as ThemeSpec[])),
53
  ];
54
 
55
  export const THEME_BY_KEY: Record<ThemeKey, ThemeSpec> = Object.fromEntries(
@@ -64,13 +47,9 @@ export function loadStoredTheme(): ThemeKey {
64
  try {
65
  const raw = window.localStorage.getItem(LS_THEME);
66
  if (raw === "dark" || raw === "light") return raw;
67
- // The branded theme key is only honoured OUTSIDE anonymous mode.
68
- // Gated behind `!ANON &&` so that (a) a runtime ?anon=1 session
69
- // falls back to light instead of rendering university colors, and
70
- // (b) a VITE_ANON=1 build constant-folds ANON to true and the
71
- // minifier dead-code-eliminates the key literal — anonymous JS
72
- // must not even MENTION the branded theme key (M3 audit fix).
73
- if (!ANON && raw === "gmu") return raw;
74
  } catch {
75
  /* ignore */
76
  }
@@ -80,7 +59,7 @@ export function loadStoredTheme(): ThemeKey {
80
  export function applyTheme(theme: ThemeKey): void {
81
  if (typeof document === "undefined") return;
82
  // Light is the :root default, so clear the attribute instead of
83
- // setting it. Dark and GMU live behind `data-theme` selectors.
84
  if (theme === "light") {
85
  delete document.documentElement.dataset.theme;
86
  } else {
 
2
  * Theme registry + persistence.
3
  *
4
  * Theme tokens are defined as CSS variables in index.css under
5
+ * `:root` (light — the default) and `[data-theme="dark"]`. This
6
+ * module is responsible for picking which of those is active at
7
+ * runtime by writing to
8
  * `document.documentElement.dataset.theme`, and for persisting the
9
  * user's choice across page loads.
10
  */
11
 
12
+ export type ThemeKey = "light" | "dark";
 
 
13
 
14
  export interface ThemeSpec {
15
  key: ThemeKey;
 
33
  tagline: "Deep navy · electric cyan",
34
  swatch: ["#0b1020", "#4cc9f0"],
35
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  ];
37
 
38
  export const THEME_BY_KEY: Record<ThemeKey, ThemeSpec> = Object.fromEntries(
 
47
  try {
48
  const raw = window.localStorage.getItem(LS_THEME);
49
  if (raw === "dark" || raw === "light") return raw;
50
+ // Migration: the university-branded "gmu" theme was removed
51
+ // (2026-07). A stored "gmu" preference from an earlier visit falls
52
+ // through to the light default — never a broken/unknown attribute.
 
 
 
 
53
  } catch {
54
  /* ignore */
55
  }
 
59
  export function applyTheme(theme: ThemeKey): void {
60
  if (typeof document === "undefined") return;
61
  // Light is the :root default, so clear the attribute instead of
62
+ // setting it. Dark lives behind the `data-theme` selector.
63
  if (theme === "light") {
64
  delete document.documentElement.dataset.theme;
65
  } else {
frontend/vite.config.ts CHANGED
@@ -15,34 +15,13 @@ function anonStaticAssets(): Plugin {
15
  return {
16
  name: "anon-static-assets",
17
  transformIndexHtml(html) {
 
 
 
 
18
  return html
19
  .replaceAll("%APP_TITLE%", APP_TITLE)
20
- .replaceAll(
21
- "%THEME_KEYS%",
22
- anonBuild ? '["dark"]' : '["dark", "gmu"]',
23
- );
24
- },
25
- generateBundle(_options, bundle) {
26
- // Anonymous builds must not ship the university-branded theme
27
- // block in the stylesheet either — a curious reviewer reading
28
- // the served CSS would find the brand name in the selector.
29
- // The block is self-contained (one attribute selector, flat
30
- // declarations, no nested braces), so a brace-bounded regex is
31
- // safe. The JS side (theme registry + stored-preference
32
- // fallback) is dead-code-eliminated in src/lib/theme.ts.
33
- if (!anonBuild) return;
34
- for (const item of Object.values(bundle)) {
35
- if (
36
- item.type === "asset" &&
37
- item.fileName.endsWith(".css") &&
38
- typeof item.source === "string"
39
- ) {
40
- item.source = item.source.replace(
41
- /\[data-theme=(?:"gmu"|gmu)\]\s*\{[^}]*\}/g,
42
- "",
43
- );
44
- }
45
- }
46
  },
47
  writeBundle(options) {
48
  if (!anonBuild) return;
 
15
  return {
16
  name: "anon-static-assets",
17
  transformIndexHtml(html) {
18
+ // %THEME_KEYS% = non-default themes the pre-hydration script in
19
+ // index.html may apply before first paint. Only "dark" exists
20
+ // since the university-branded theme was removed (2026-07) —
21
+ // which also retired this plugin's old CSS-stripping hook.
22
  return html
23
  .replaceAll("%APP_TITLE%", APP_TITLE)
24
+ .replaceAll("%THEME_KEYS%", '["dark"]');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  },
26
  writeBundle(options) {
27
  if (!anonBuild) return;