Files
magpie/internal/gui/assets/omarchy.css
T
chenluzhou 5fc2f87d13 gui: in colorblind mode a quota legend key is its window's dash, the even paces are dotted, and the balance curve and the good grade keep their look (#2073)
A review of db25c4ee found that colorblind mode reached past the quota
curve and that its legend shapes matched nothing on the plot:

- The fallback rules `.qc-line:not([data-series="0"])...` and the
  matching `.qc-key` rule also matched elements with no data-series, so
  the balance curve's solid line became dashed like its fitted line, and
  its legend dot became a ring in var(--c4) while the line was var(--c1).
- A filled circle, hollow square or diamond in the legend appeared
  nowhere on the plot, so it didn't tell a reader which line was which.
  Series 3 and up shared one dash and one shape.
- The 7-day line's 6 2.5 dash sat beside its own 3 3 dashed even pace in
  the same colour, while the tooltip still said "Solid: what was left.
  Dashed: an even pace".
- The Context tab's "good" grade took var(--c2), which the palette turns
  amber, next to "fair" in --amber (dark #fbbf24 vs #f2b544).
- omarchy.css made the first legend dot round with colorblind mode off.
- The legend set its colour twice (--sw and background) and undid it
  with !important.

Now, with colorblind mode on:

- drawQuotaPlot tags each window's path.qc-line and line.qc-even with
  data-series (its index mod 7, the same slot as its colour), and the
  quota legend tags its key. Seven dash patterns, one per slot, apply to
  `:is(.qc-line, .qc-dash)[data-series=N]`, so a line and its key can't
  drift apart. Nothing else sets data-series, so the balance curve is as
  on main.
- Each quota legend key shows a 22px sample of its window's line
  (svg.qc-sample > line.qc-dash) in place of the dot; with the mode off
  the sample is hidden and the dot is as on main.
- The even paces are dotted (0 4, round caps), unlike every window's
  dash; the curve's tooltip, set in box.draw, says "Each window's line
  has the dash shown beside its name. Dotted: an even pace, ..." in en,
  zh, zh-TW, ja and de.
- `.ctx-ring.good` / `.ctx-grade-word.good` take --c1, the palette's
  blue.
- omarchy.css is back to main's; the legend's `--sw` and !important are
  gone.
- The Settings note now says what the mode does ("Colorblind-safe chart
  colors, and each allowance window's line in a dash of its own"), and
  gui-shell.md says the note is the Off/On control's tooltip, as the
  code has it.

Run on db25c4ee + this change (upstream/main f074996d9 unchanged),
Playwright 1.58.2, Chromium and WebKit:

- New tests fail without the change: with db25c4ee's assets the 10
  "colorblind mode separates quota windows by colour and dash, in the
  legend too" (both engines, 5 languages), the 2 "seven windows have
  seven dashes" and the 2 balance-curve "colorblind mode leaves the
  balance curve's solid line, dashed fit and dot" fail, 14/14 (e.g.
  "key 0 shows its line, not a dot"). Broken by hand on this change,
  each is caught: the good-grade rule removed ("good and fair too close:
  light: {good: 41.5, fair: 26.0}"), the dotted pace removed (pace dash
  equals its default), the colorblind tooltip removed ("the tooltip names
  the dashes and dots: Solid: ..."), the :not() fallback put back ("the
  balance stays solid: line 2.5px, 2px"), series 3-6 given one dash
  ("every window its own dash: 4 !== 7"), the sample's dash rule dropped
  (key 1's dash).
- quota-curve.test.cjs 27/27, balance-curve.test.cjs 6/6; the colorblind
  tests 14/14 three runs in a row at --test-concurrency=4.
- balance-currencies, context-window, quota-read-at, settings-general,
  usage-ledger-chart, api-key-theme, gui-de, gui-ja, gui-zh-tw,
  i18n-keys, keep-awake, lightweight, omarchy, seg-contrast, segs-glide,
  settings-search, settings-sections and usage-ledger*: with the two
  above, 305/315. The 10 failures are settings-general's WebKit cases
  ('English\n' for 'English' from #langPick's innerText, a span and an
  svg), which fail the same 10 on upstream/main f074996d9 in this
  Playwright's WebKit; not fixed here.
- node --check app.js, i18n.js and both tests: clean.
- Sandbox HOME, GOPATH/GOMODCACHE/GOCACHE pinned, set -o pipefail:
  gofmt -l on the changed .go files prints nothing; go vet ./...,
  GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...,
  go build, GOOS=linux go build -tags nogui, GOOS=windows go build and
  go test -tags nogui ./... all exit 0 (the only output is the existing
  cgo -Wenum-conversion warning in trayimage_darwin.go);
  TestSettingsColorblindMode passes.
- Not run: the whole GUI suite (707 files; only the files above), the real Linux app under
  WebKitGTK, and a check by a colour-blind reader.
2026-10-14 16:28:05 +08:00

71 lines
4.9 KiB
CSS

/* Omarchy: magpie drawn in Omarchy's own design language, only on Omarchy.
omarchy.js puts the class on <html> and the theme's colours, font, border
and rounding (from ~/.local/state/omarchy/current/theme and Hyprland) in
the variables; everything here is scoped under html.omarchy, so no other
system sees any of it. Omarchy's shell draws flat: no shadows, no blur, no
rounding (Hyprland's decoration:rounding, 0 by default), popups framed by
the window border's colour, uppercase letter-spaced labels, and a row
picked out by a faint fill with its text in the accent. */
/* what only Omarchy shows, and what it hides: the Appearance setting follows
Omarchy's theme instead of offering light and dark */
.om-only { display: none !important; }
html.omarchy .om-hide { display: none !important; }
html.omarchy .om-only { display: revert !important; }
html.omarchy .om-theme-name { color: var(--accent); font-size: 12px; white-space: nowrap; }
html.omarchy, html.omarchy body { font-family: var(--ui-font, var(--font)); font-size: var(--om-size); }
html:where([data-fonts]).omarchy, html:where([data-fonts]).omarchy body { font-style: var(--ui-style, inherit); font-weight: var(--ui-weight, inherit); font-stretch: var(--ui-stretch, 100%); }
html.omarchy body { -webkit-font-smoothing: antialiased; }
/* square, or rounded as far as Hyprland rounds its windows; what spins or
draws a dial stays round, as does a slider.s knob; a status dot goes square, like Omarchy.s workspace marks */
html.omarchy *, html.omarchy *::before, html.omarchy *::after { border-radius: var(--om-radius) !important; }
html.omarchy :is(.pq-dial, .pq-dial b, .sk-ring, .si-spin, .mk-spin, .signing .spinner, .eslide .knob, .effort-ticks i),
html.omarchy input[type="range"]::-webkit-slider-thumb { border-radius: 50% !important; }
/* no shadows or frosted glass: surfaces are the theme's background */
html.omarchy * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.omarchy :is(.pop, .modal .dialog, .status.lift, body.panel .profiles.open, .list, body.panel .list, .seg > .thumb) { box-shadow: none; }
html.omarchy body.panel { background: var(--bg); border: var(--om-border) solid var(--om-edge); }
/* popups, menus and dialogs: framed by the window border's colour */
html.omarchy :is(.pop, body.panel .profiles.open, .status.lift) { background: var(--pop-bg); border: var(--om-border) solid var(--om-edge) !important; }
html.omarchy .modal { background: color-mix(in srgb, var(--bg) 55%, transparent); }
html.omarchy .modal .dialog { background: var(--bg); border: var(--om-border) solid var(--om-edge); }
/* labels as Omarchy's shell sets its headings: uppercase, spaced out */
html.omarchy :is(.label, .pop li.group, .kpi span, .editor .ehead + * .k) { letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
html.omarchy .brand { letter-spacing: 0; font-weight: 700; }
/* the tabs: no track, the chosen one a faint square with its text in the accent */
html.omarchy .seg { background: transparent; }
html.omarchy .seg > .thumb { background: var(--om-sel); }
html.omarchy :is(.seg button.on, .ptabs button.on, .opt.on) { color: var(--accent); }
html.omarchy :is(.segs, .ptabs) { background: transparent; }
html.omarchy :is(.segs, .ptabs) > .thumb { background: var(--om-sel); box-shadow: inset 0 0 0 1px var(--om-sel-line); }
/* lists: a hairline frame, rows picked out by a faint fill */
html.omarchy .list { border: 1px solid var(--line); background: transparent; }
html.omarchy .row:hover { background: var(--om-hover); }
/* controls: Omarchy's buttons are a faint fill under a thin edge */
html.omarchy .field, html.omarchy body.panel .field, html.omarchy body.panel .field:hover { background: var(--om-hover); box-shadow: inset 0 0 0 1px var(--om-hover-line); }
html.omarchy .field:hover { background: var(--om-sel); }
html.omarchy .field.open, html.omarchy body.panel .field.open { box-shadow: inset 0 0 0 1px var(--accent); }
html.omarchy .icon:hover { background: var(--om-sel); color: var(--accent); }
html.omarchy .text.primary { background: var(--accent); color: var(--accent-fg); }
/* a menu's row under the cursor or keys: the fill and the accent, like Walker's */
html.omarchy :is(.pop li.sel, .pop li:hover:not(.group), .row-menu .rm-item:not(:disabled):is(:hover, :focus)) { background: var(--om-sel); color: var(--accent); }
html.omarchy :is(.pop li.sel, .pop li:hover) :is(.v, .n) { color: inherit; }
/* Linux's close button: square like the rest */
html.omarchy .icon.winclose { background: transparent; }
html.omarchy .icon.winclose:hover { background: var(--red-soft); color: var(--red); }
html.omarchy ::selection { background: var(--om-sel); color: var(--accent); }
html.omarchy body.side-nav :is(#nav button[data-view], #prefs).on { background: var(--om-sel); box-shadow: inset 0 0 0 1px var(--om-sel-line); color: var(--accent); }
html.omarchy .nav-hl { background: var(--om-sel); }
html.omarchy .nav-s.cur { color: var(--accent); }