Skip to content

fix(ui): readable danger text in dark theme - #35904

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-0wa2pw
Nov 20, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-0wa2pw

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread
Fixes #35658

Clause-②: no
Metadata-protocol: none

维护者速读

  • 深色主题下,列表右键菜单和选中后「…」菜单里的「删除」从几乎看不见的暗红变成清楚的亮红(对比度 1.7:1 → 6.3:1);浅色主题和删除确认框里的红底按钮完全不变。
  • 属于「列表页重做」专题,是你走查列表页时看到的问题;全站所有用危险红当文字的地方一起变清楚。
  • 出错最坏是深色下某处红字颜色和以前不同,只改颜色、不动数据和流程,可以直接撤回。
  • 无

What changes

In dark theme, --destructive is 0 62.8% 30.6%, a deep red chosen as the fill of red buttons (white text on it). text-destructive used the same value as a text colour, which measured 1.73:1 on the dark menu (1.49:1 on the hovered item). One value cannot do both jobs: a red that reads at 4.5:1 on near-black is too light to carry white text at 4.5:1.

So the text colour is split from the fill, with no call site edited:

  • Tailwind 4 resolves a text-* colour from the --text-color-* namespace before --color-*. Each shipped @theme (@object-ui/components, the console, the runner, and the objectui init app template in app-generator.ts) now declares --text-color-destructive: hsl(var(--destructive-text, var(--destructive))).
  • Only .dark defines --destructive-text (0 91% 71%). Light theme leaves it unset, so text-destructive falls back to --destructive and is byte-identical in what it renders; a host theme that sets --destructive keeps working in light mode.
  • bg-, border-, ring-destructive and --destructive-foreground are untouched, so red buttons look the same in both themes.
  • Every text-destructive in the repo (and its hover:/focus:/opacity variants) picks this up, menus or not. The one inline danger text colour (the Gantt resource view's over-capacity label, hsl(var(--destructive))) now reads the same token.
  • content/docs/frontend/theming.mdx names the new token and when a custom dark theme should set it.

Tests

New packages/components/src/__tests__/dark-danger-text-contrast-35658.test.ts, per shipped stylesheet (components, console, runner): compiles the sheet's own @theme with Tailwind and asserts text-destructive reads --text-color-destructive while bg-/border-destructive read --color-destructive; :root leaves --destructive-text unset; the dark danger text clears 4.5:1 on every dark surface the sheet defines (--background, --card, --popover, --muted, --accent, --secondary); the dark red-button pair keeps its values. Plus the app template carries the same split.

Readings
  • Head: Tests 13 passed (13).
  • Reverse check (fix committed, the four theme files checked out from origin/main, run, restored with git checkout HEAD --, git diff HEAD empty): Tests 7 failed | 6 passed (13).
  • pnpm --dir ui exec vitest run packages/components/ packages/plugin-gantt/ packages/cli/src/__tests__/app-generator.test.ts exit 0: Test Files 590 passed | 2 skipped (592), Tests 5587 passed | 138 skipped (5725).
  • pnpm --filter @object-ui/components type-check exit 0 after building its dependency closure; tsc -p tsconfig.test.json --listFilesOnly lists the new test file.

Acceptance notes

  • Read first, by risk: the @theme and .dark hunks of packages/components/src/index.css; the same two hunks in apps/console/src/index.css (the console's iOS dark surfaces are the ones measured below).
  • Light theme's text-destructive is 3.76:1 on a white menu (3.22:1 hovered) and the light red button's white text is 3.60:1, both under 4.5:1. Not changed here: the card rules out touching light values. Noted for triage, not filed.
  • Two inline style={{ color: 'var(--destructive, #ef4444)' }} export-error lines (ObjectGrid and ListView) resolve to an invalid colour (a bare HSL triple), so the error text renders in the inherited colour, not red. Readable either way; left alone.
  • Two-minute check: run the console in dark theme, right-click a list row; the menu's Delete reads clearly red.
  • Branch name is the platform-assigned claude/project-thread-0wa2pw (the claim names it), not claude/issue-35658-….

Verification

Measured in the running console (examples/app-showcase backend, ui/apps/console Vite dev serving this tree; Chromium, system theme emulated light and dark, Accounts list). Before = the three stylesheets from origin/main 8c18a362; after = head. Ratio = WCAG 2 contrast of the computed text colour on its composed backdrop.

Theme Where Before After
dark row right-click menu, Delete rgb(127, 29, 29) on rgb(26, 26, 30) 1.73:1 rgb(248, 114, 114) on rgb(26, 26, 30) 6.31:1
dark same, hovered on rgb(39, 39, 43) 1.49:1 5.41:1
dark selection "…" menu, Delete 1.73:1 6.31:1
dark same, hovered 1.49:1 5.41:1
dark delete confirm red button rgb(248, 250, 252) on rgb(127, 29, 29) 9.58:1 9.58:1 (unchanged)
light both menus, Delete rgb(239, 68, 68) on white 3.76:1, hovered 3.22:1 identical
light delete confirm red button 3.60:1 identical

Screenshots (before/after, both themes, each row above) and the measurement script are in the project files under build-seat1/35658/.

Local gates
  • node scripts/pm/dispatch-gates.mjs --ran at head 00cc92e4: 71 derived, 71 run, 0 NOT-MEASURED, every recorded exit 0. 68 of them were run on 05a265c1 (same tree except the new test's comment stripping, which now goes through scripts/js-comment-mask.mjs after check-hand-rolled-comment-mask flagged the hand-rolled regex); check:skill-examples (exit 3 first: packages/spec not yet built), check:doc-formula-expressions and pnpm --dir ui exec vitest run scripts/ (Tests 5111 passed | 2 skipped) were run on the head.
  • node scripts/pm/overlap-check.mjs: VERDICT clean exit 0, merges cleanly into origin/main 8c18a362.
  • The browser measurements were taken at 05a265c1; the stylesheets are byte-identical at the head.
  • Every family CI runs beyond the derived set is read from this PR's check runs.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgTTFr43A9SHzSvgUoy

Text utilities read --text-color-destructive, which maps to a dark-only
--destructive-text; light theme and the red-button fill are unchanged.
Adds the pin test, a changeset and the theming page note.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L6bhgTTFr43A9SHzSvgUoy
@objectstack-fleet
objectstack-fleet Bot requested a review from os-sales November 20, 2026 17:45
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4

席位核对 — ACCEPT (L1-b)

Head-sha: 00cc92e449ab8e1c975a7415889ed047faa50e43 · read 2026-11-20T17:49Z

维护者速读

  • 深色主题下菜单里的「删除」等红字改用单独一档亮红,浅色主题和红底按钮不变;改法是主题色值,不动任何调用处,撤回只需回退这个 PR。
  • 只读了现 head;CI 在读时 0 失败、33 项仍在跑,落地前必须读到全绿。
  • 附带看到三处卡外的小问题(见下),都只记录不在本 PR 修。

What was checked

  • Face (l1-face.mjs --pr 35904 at this head): shape, Fixes #35658 first line, no keyword on another card, no releases path, changeset covers all four touched published packages, Clause-②: no / Metadata-protocol: none, skills-docs and dogfood not owed. INCOMPLETE only on floor-checks / all-checks: at read time 15 success · 10 expected skip · 0 failed · 33 pending (Lint & Repo Gates and TypeScript Type Check not yet reported). Landing reads every check green on this head.
  • Fixes is right: the card asks (1) dark danger text ≥ 4.5:1, (2) every text-destructive on a dark surface, (3) light unchanged, (4) red buttons unchanged. The fix is at the token, so all 271 files using text-destructive (and hover:/focus://NN variants) move together; light :root leaves --destructive-text unset; --destructive / --destructive-foreground untouched in both themes. Whole card delivered.
  • Claim file surface (7045018166): the five named files match the diff, plus the new test, the changeset and content/docs/frontend/theming.mdx (prose naming the new token). Nothing outside.
  • Mechanism, own positive control: compiled with Tailwind 4.3.3 (the repo's version) in a scratch dir. With --text-color-destructive in @theme: .text-destructive { color: var(--text-color-destructive) }, text-destructive/80 → color-mix(… var(--text-color-destructive) 80% …), bg-, border-, fill-, stroke-, decoration-destructive still var(--color-destructive). Without it: .text-destructive reads var(--color-destructive). So the namespace split is real, not assumed.
  • Values: hsl(0 91% 71%) = rgb(248,114,114), which matches the browser reading in the evidence. The browser run was at 05a265c1; at this head f198f758..00cc92e4 touches only the test file (3+/1−), so the stylesheets measured are the ones under review. The test's reverse check (7 failed on main's theme files) is its positive control.
  • Every shipped @theme: git grep -- '--color-destructive:' finds exactly the four the PR edits (components, console, runner, objectui init template). Inline hsl(var(--destructive)) used as text: only the Gantt peak label (fixed) and a demo file; the Gantt bar fill and GanttView ring keep the fill, correctly.
  • Sentence-by-sentence: .changeset/35658-dark-danger-text.md body paragraph and the new theming.mdx paragraph plus its .dark snippet lines: each sentence matches the diff (text reads --destructive-text with fallback, only .dark sets it, bg/border/ring and red buttons keep --destructive, init template and Gantt label carry it, a host overriding dark --destructive sets --destructive-text beside it).
  • Not copied from Twenty/Attio: a two-token split in the repo's own @theme shape.

Noted, not owed by this PR (carrier: none; for the seat)

  1. app-shell/.../previews/FlowCanvas.tsx:1107,1139: fill-destructive / stroke-destructive on SVG arrowheads and edges keep the deep dark fill. Not text and not text-destructive, so outside the card's words; likely under the 3:1 non-text ratio in dark theme (not measured in a browser).
  2. plugin-markdown/src/markdown-theme.ts:120-121: the caution alert's border and title use var(--destructive) (a bare HSL triple, so an invalid colour: the title renders in the inherited colour in both themes). Same defect class as the dev's ObjectGrid/ListView note; a third site.
  3. Light theme danger text 3.76:1 (3.22:1 hovered) and the light red button 3.60:1, both under 4.5:1, as the PR's acceptance notes say. The card forbids touching light values, so a change there is the maintainer's call.

L2: not owed (Clause-②: no, no published schema, no governed rule text, no narrowing).

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Landing · 2026-11-20T18:08Z · The seat adopts and lands PR #35904 on head 00cc92e4 (card #35658, dark-theme Delete contrast in menus). Clause-②: no, so no declaration L2 is owed.

L1-b ACCEPT 7046635196 at 00cc92e4 (this head). check-governed-merges --pr 35904 reads NOT governed, 192 changed lines (under 3000). landing-k reads K = 0. All 62 check-runs on the head are success (52) or skipped (10). The seat readies this PR and arms auto-merge in this same stroke. The PR carries Fixes #35658.

Side findings from the build (light-theme Delete contrast, two other invalid or dark-only colour uses) are filed by the seat as separate cards; they are outside this card's scope.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 20, 2026 18:09
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 20, 2026
Merged via the queue into main with commit 227a16a Nov 20, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-0wa2pw branch November 20, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants