From 2a6ca696b76b2ec5b988cb76ba2ad72c1182a828 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 11:07:19 +0000 Subject: [PATCH 01/43] Start squad record for feature 217 --- specs/feature-217-clear-theme/log.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 specs/feature-217-clear-theme/log.md diff --git a/specs/feature-217-clear-theme/log.md b/specs/feature-217-clear-theme/log.md new file mode 100644 index 00000000..134253e7 --- /dev/null +++ b/specs/feature-217-clear-theme/log.md @@ -0,0 +1,8 @@ +# Log: feature-217-clear-theme (issue #217) + +One line per pipeline step: date and time of day (UTC), step, member, result. Lead decisions and escalations +are quoted in full. + +| Date | Step | Member | Result | +| ---- | ---- | ------ | ------ | +| 2026-11-28 11:07 | 1 Intake | Orchestrator | Issue #217 is an open feature (enhancement); branch claude/squad-feature-217-vz9kx1 off latest main; work folder specs/feature-217-clear-theme | From 00ffbd931f0e6ea81889061c340abdb6c3c6a66e Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 11:13:17 +0000 Subject: [PATCH 02/43] Add spec draft and log for feature 217 --- specs/feature-217-clear-theme/log.md | 2 + specs/feature-217-clear-theme/spec.md | 156 ++++++++++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 specs/feature-217-clear-theme/spec.md diff --git a/specs/feature-217-clear-theme/log.md b/specs/feature-217-clear-theme/log.md index 134253e7..83272399 100644 --- a/specs/feature-217-clear-theme/log.md +++ b/specs/feature-217-clear-theme/log.md @@ -6,3 +6,5 @@ are quoted in full. | Date | Step | Member | Result | | ---- | ---- | ------ | ------ | | 2026-11-28 11:07 | 1 Intake | Orchestrator | Issue #217 is an open feature (enhancement); branch claude/squad-feature-217-vz9kx1 off latest main; work folder specs/feature-217-clear-theme | +| 2026-11-28 11:13 | 2a Spec | Lead | RESULT: ESCALATE — (a) openHAB card needs icon and chip colour (house icon, #0369a1/#38bdf8 recommended); (b) updates button light tint 10 % gives 4.49:1 (8 % recommended) (opus/medium · 69,405 tokens · 14 tool uses · 59 s · 24 in · 3,927 out · 447,674 cache read · 63,023 cache write · 241,643 weighted) | +| 2026-11-28 11:13 | 2a Spec | Product Manager | Answer: (a) house icon with #0369a1 light / #38bdf8 dark; (b) lower the light tint of the updates button to 8 % (dark stays 14 %) | diff --git a/specs/feature-217-clear-theme/spec.md b/specs/feature-217-clear-theme/spec.md new file mode 100644 index 00000000..9f58a520 --- /dev/null +++ b/specs/feature-217-clear-theme/spec.md @@ -0,0 +1,156 @@ +# Spec: Refresh the default look: theme Clear (light and dark) + +Source: Issue #217 +Status: Draft + +The issue text (sections 1–13, *Constraints*) is the binding design specification: token values, card colours, icon +paths and sizes are taken from it and not restated here. The mockups in `docs/design/v1.5.0/` only illustrate it. +Terms as the issue defines them: **mode** is light or dark (`pimonitor-theme`, `data-theme`, the header button), +**theme** is the visual design; after this change there is one theme, Clear. + +## Problem + +People viewing the dashboard, on a desktop or a phone, see emoji icons that render differently on every system and +ignore the palette, ten coloured top borders competing with the status colours that carry meaning, status text in +light mode below 4.5:1 contrast (`#16a34a` on white 3.3:1, `#d97706` 3.2:1), 36 px header buttons below the 44 px +touch target, and flat charts with a bar percentage no more prominent than the byte figures beside it. + +## Scenarios + +- S1: Given the page in light mode, when it loads, then header, banner, cards, dialogs and footer show the Clear + light palette (issue §1), with the same cards, order, texts and data as before. +- S2: Given the operating system in dark mode and no stored choice, when the page loads, then it shows the Clear dark + palette; when the operating system switches, the page follows live. +- S3: Given any mode, then every card heading shows a 28 px chip with a stroke icon in the card's colour (§2, §3) and + no card has a coloured top border; the header shows the 44 px logo tile, the title and the subtitle. +- S4: Given light mode, when the user presses the mode button (moon icon), then the page switches to dark, the button + shows the sun icon, its `aria-label` reads `Switch to light theme` and `aria-pressed` is `true`, the choice is stored, + and sparklines and gauges are redrawn in the dark palette without a reload; pressing again reverses all of it. +- S5: Given a value in `warn` or `crit` (CPU, temperature, a bar), then its text uses the level's ink colour and its + bar fill or gauge arc the level's base colour. +- S6: Given Memory & Swap and Filesystems, then each bar row shows the name on the left and, on the right, the + percentage emphasised (primary text colour, or the ink colour at `warn`/`crit`) followed by the muted byte figures, + e.g. `41.2 %` `· 1.6 GB / 3.8 GB`. +- S7: Given a sparkline with at least two points, then it shows a 2 px accent line, a gradient fill fading to + transparent and a ringed dot on the newest point. +- S8: Given the Load Average card, then each of the three gauges shows its value inside the arc and its label + (`1 min`, `5 min`, `15 min`) below. +- S9: Given a clickable card (CPU Usage, Load Average, Temperature, Memory & Swap), then its heading button ends with + a chevron and opens the detail view as today; a screen reader announces the same name as today, including + `— alert: warn` / `— alert: crit`. +- S10: Given an active alert, then the banner shows the alert icon and the same text as today, in the worst level's + ink colour on a tinted background. +- S11: Given the Network card, then each interface row shows the name and, on the right, a download and an upload rate, + each after an arrow icon; a screen reader announces them as "Download …" and "Upload …". +- S12: Given a phone-width viewport, then the header wraps, and every header button, clickable heading, the updates + button and every dialog button is a touch target of at least 44 px. + +## Errors and edge cases + +- E1: Storage unavailable or no stored choice: the mode follows `prefers-color-scheme` as today; the mode button + still shows the icon of the mode it switches to. +- E2: A stored mode is applied before the first paint (`theme-init.js` unchanged): no flash of the other palette or of + the other mode icon. +- E3: A sparkline with fewer than two points draws nothing (no line, fill or dot); a flat series is padded as today. +- E4: A load gauge in a narrow single column (phone) or a wide three-column layout is never clipped; the value inside + the arc does not overlap it. +- E5: A long mountpoint or interface name is cut with an ellipsis as today; the percentage and byte figures stay + visible. +- E6: The openHAB card (shown only when openHAB is detected; not in the issue's tables or mockups) gets the same + treatment: chip, stroke icon, no top border; its warning state stays a warning-coloured border without a top border. + Its icon and chip colour: *Open questions*, Q1. +- E7: Text on an `--accent` fill (the active range button, `Unlock`) uses `--on-accent`: the hard-coded white of today + reaches only 2.5:1 on the dark accent. +- E8: Status text not named in the issue's list follows its rule too: the new version in the updates list, the API key + error, the openHAB state line and `Things offline` toggle. +- E9: Without JavaScript the page shows the static placeholders as today, now with SVG icons. +- E10: Emoji in character-reference form (today's layout button is `⚙️`) count as emoji. + +## Non-functional requirements + +- N1: Content-Security-Policy unchanged (`style-src 'self'; script-src 'self'`): no `style` attribute, ``, + "script body": ``, + "script without src": ``, + "script src plus body": ``, + "upper case script tag": ``, + } { + if len(inlineFindings(html)) == 0 { + t.Errorf("%s: scanner reported nothing, want a finding", name) + } + } + }) +} + +const svgNamespace = "http://www.w3.org/2000/svg" + +var ( + absoluteURLRE = regexp.MustCompile(`(?i)https?://[^\s'"<>)]*`) + protoRelRE = regexp.MustCompile(`["'(=]\s*//[A-Za-z0-9]`) + cssImportRE = regexp.MustCompile(`(?i)@import\b`) +) + +// originFindings lists every reference to another origin: an absolute URL +// other than the SVG namespace, a protocol-relative URL or a CSS @import. +func originFindings(text string) []string { + var out []string + for _, u := range absoluteURLRE.FindAllString(text, -1) { + if u != svgNamespace { + out = append(out, u) + } + } + out = append(out, protoRelRE.FindAllString(text, -1)...) + if cssImportRE.MatchString(text) { + out = append(out, "@import") + } + return out +} + +func TestAssets_NoOtherOrigin_AC11(t *testing.T) { + t.Run("AC11 no asset references another origin", func(t *testing.T) { + for _, name := range []string{"index.html", "style.css", "app.js", "chart.js", "gauge.js", "theme-init.js"} { + if got := originFindings(readAsset(t, name)); len(got) != 0 { + t.Errorf("%s: found %v, want none", name, got) + } + } + }) + + t.Run("AC11 the scanner allows the SVG namespace only", func(t *testing.T) { + if got := originFindings(` // a comment`); len(got) != 0 { + t.Fatalf("scanner on the SVG namespace: got %v, want none", got) + } + for name, text := range map[string]string{ + "https url": ``, + "http url": `fetch('http://example.com/x')`, + "other xml namespace": `xmlns="http://www.w3.org/1999/xlink"`, + "protocol relative": ` From 095c36b065fe65eb878d06e61a2d71fbc770c5e8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:50:18 +0000 Subject: [PATCH 41/43] Add a focus ring to the header buttons (work in progress) --- internal/web/assets/style.css | 6 ++++ internal/web/look_test.go | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/internal/web/assets/style.css b/internal/web/assets/style.css index b03dfa72..2390b3b9 100644 --- a/internal/web/assets/style.css +++ b/internal/web/assets/style.css @@ -209,6 +209,12 @@ header h1 { border-color: var(--accent); } +.theme-toggle:focus-visible, +.layout-toggle:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 2px; +} + header .subtitle { color: var(--muted); font-size: 13px; diff --git a/internal/web/look_test.go b/internal/web/look_test.go index e8c12a2b..8d66518f 100644 --- a/internal/web/look_test.go +++ b/internal/web/look_test.go @@ -363,3 +363,66 @@ func TestStyleCSS_HeadingButtonTypography_AC5(t *testing.T) { } }) } + +var headerToggleSelectors = []string{".theme-toggle", ".layout-toggle"} + +var nonNegativeLengthRE = regexp.MustCompile(`^\+?(?:\d+|\d*\.\d+)(?:px|rem|em)?$`) + +// headerToggleFocusFindings checks the keyboard focus ring and the hover +// state of one header button selector. +func headerToggleFocusFindings(rules []cssRule, sel string) []string { + var out []string + focus := declsFor(rules, sel+":focus-visible") + if len(focus) == 0 { + return []string{sel + ":focus-visible has no rule"} + } + if normCSS(focus["outline"]) != "2pxsolidvar(--accent)" { + out = append(out, fmt.Sprintf("%s:focus-visible outline = %q, want 2px solid var(--accent)", sel, focus["outline"])) + } + if !nonNegativeLengthRE.MatchString(strings.TrimSpace(focus["outline-offset"])) { + out = append(out, fmt.Sprintf("%s:focus-visible outline-offset = %q, want a non-negative length", sel, focus["outline-offset"])) + } + return append(out, headerToggleHoverFindings(rules, sel)...) +} + +// headerToggleHoverFindings requires the hover rule to change the border +// colour only, so nothing stacks with the focus ring. +func headerToggleHoverFindings(rules []cssRule, sel string) []string { + var out []string + hover := declsFor(rules, sel+":hover") + if _, ok := hover["border-color"]; !ok { + out = append(out, sel+":hover does not set border-color") + } + for prop := range hover { + if prop != "border-color" { + out = append(out, fmt.Sprintf("%s:hover sets %q, want border-color only", sel, prop)) + } + } + return out +} + +func TestStyleCSS_HeaderButtonFocusRing_AC5(t *testing.T) { + t.Run("AC5 header buttons have an explicit accent focus ring and a border-only hover", func(t *testing.T) { + rules := parseCSSRules(readAsset(t, "style.css")) + for _, sel := range headerToggleSelectors { + for _, f := range headerToggleFocusFindings(rules, sel) { + t.Error(f) + } + } + }) + + t.Run("AC5 the check accepts a conforming rule and rejects a missing ring", func(t *testing.T) { + const hover = ".theme-toggle:hover { border-color: var(--accent); }\n" + good := hover + ".theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n" + bad := hover + ".theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }\n" + if f := headerToggleFocusFindings(parseCSSRules(good), ".theme-toggle"); len(f) != 0 { + t.Errorf("conforming CSS: got findings %v, want none", f) + } + if f := headerToggleFocusFindings(parseCSSRules(bad), ".theme-toggle"); len(f) != 2 { + t.Errorf("literal colour and negative offset: got %d findings %v, want 2", len(f), f) + } + if f := headerToggleFocusFindings(parseCSSRules(hover), ".theme-toggle"); len(f) != 1 { + t.Errorf("no focus rule: got %d findings %v, want 1", len(f), f) + } + }) +} From fda0d8a89a3807febe031c246759925942a6424d Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:58:30 +0000 Subject: [PATCH 42/43] Soft halo hover for the header buttons (work in progress) --- internal/web/look_test.go | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/internal/web/look_test.go b/internal/web/look_test.go index 8d66518f..d3e50e99 100644 --- a/internal/web/look_test.go +++ b/internal/web/look_test.go @@ -385,17 +385,22 @@ func headerToggleFocusFindings(rules []cssRule, sel string) []string { return append(out, headerToggleHoverFindings(rules, sel)...) } -// headerToggleHoverFindings requires the hover rule to change the border -// colour only, so nothing stacks with the focus ring. +// headerToggleHoverFindings requires the soft-halo hover: the border keeps +// its resting colour, the box-shadow adds a 3px accent halo to the resting +// shadow, and no outline competes with the focus ring. func headerToggleHoverFindings(rules []cssRule, sel string) []string { var out []string hover := declsFor(rules, sel+":hover") - if _, ok := hover["border-color"]; !ok { - out = append(out, sel+":hover does not set border-color") + if _, ok := hover["border-color"]; ok { + out = append(out, sel+":hover sets border-color, want the resting border") } - for prop := range hover { - if prop != "border-color" { - out = append(out, fmt.Sprintf("%s:hover sets %q, want border-color only", sel, prop)) + if _, ok := hover["outline"]; ok { + out = append(out, sel+":hover sets outline, want a box-shadow halo") + } + shadow := normCSS(hover["box-shadow"]) + for _, part := range []string{"var(--shadow)", "0003px", "color-mix(insrgb,var(--accent)", "transparent"} { + if !strings.Contains(shadow, part) { + out = append(out, fmt.Sprintf("%s:hover box-shadow = %q, want it to contain %q", sel, hover["box-shadow"], part)) } } return out @@ -412,17 +417,21 @@ func TestStyleCSS_HeaderButtonFocusRing_AC5(t *testing.T) { }) t.Run("AC5 the check accepts a conforming rule and rejects a missing ring", func(t *testing.T) { - const hover = ".theme-toggle:hover { border-color: var(--accent); }\n" - good := hover + ".theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n" - bad := hover + ".theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }\n" - if f := headerToggleFocusFindings(parseCSSRules(good), ".theme-toggle"); len(f) != 0 { + const halo = ".theme-toggle:hover { box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }\n" + const ring = ".theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }\n" + badRing := ".theme-toggle:focus-visible { outline: 2px solid #fff; outline-offset: -2px; }\n" + oldHover := ".theme-toggle:hover { border-color: var(--accent); }\n" + if f := headerToggleFocusFindings(parseCSSRules(halo+ring), ".theme-toggle"); len(f) != 0 { t.Errorf("conforming CSS: got findings %v, want none", f) } - if f := headerToggleFocusFindings(parseCSSRules(bad), ".theme-toggle"); len(f) != 2 { + if f := headerToggleFocusFindings(parseCSSRules(halo+badRing), ".theme-toggle"); len(f) != 2 { t.Errorf("literal colour and negative offset: got %d findings %v, want 2", len(f), f) } - if f := headerToggleFocusFindings(parseCSSRules(hover), ".theme-toggle"); len(f) != 1 { + if f := headerToggleFocusFindings(parseCSSRules(halo), ".theme-toggle"); len(f) != 1 { t.Errorf("no focus rule: got %d findings %v, want 1", len(f), f) } + if f := headerToggleHoverFindings(parseCSSRules(oldHover), ".theme-toggle"); len(f) != 5 { + t.Errorf("border-colour hover without halo: got %d findings %v, want 5", len(f), f) + } }) } From 4ccff361b33064edd15046d85f0026d70d964280 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 28 Nov 2026 12:58:59 +0000 Subject: [PATCH 43/43] Soft halo hover for the header buttons --- internal/web/assets/style.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/web/assets/style.css b/internal/web/assets/style.css index 2390b3b9..80638e9b 100644 --- a/internal/web/assets/style.css +++ b/internal/web/assets/style.css @@ -201,12 +201,13 @@ header h1 { border: 1px solid var(--border); border-radius: var(--radius-control); box-shadow: var(--shadow); + transition: box-shadow 0.15s ease; cursor: pointer; } .theme-toggle:hover, .layout-toggle:hover { - border-color: var(--accent); + box-shadow: var(--shadow), 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); } .theme-toggle:focus-visible,