Repository navigation
fix(ui): readable danger text in dark theme - #35904
Conversation
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
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L6bhgTTFr43A9SHzSvgUoy
|
repo:objectstack#1 · os-sales · session_01L6bhgUmopshYqDCrYekUj4 席位核对 — ACCEPT (L1-b)Head-sha: 维护者速读
What was checked
Noted, not owed by this PR (carrier: none; for the seat)
L2: not owed ( |
|
repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob Landing · 2026-11-20T18:08Z · The seat adopts and lands PR #35904 on head L1-b ACCEPT 7046635196 at 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. |
Requested by Sales · project thread
Fixes #35658
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
In dark theme,
--destructiveis0 62.8% 30.6%, a deep red chosen as the fill of red buttons (white text on it).text-destructiveused 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:
text-*colour from the--text-color-*namespace before--color-*. Each shipped@theme(@object-ui/components, the console, the runner, and theobjectui initapp template inapp-generator.ts) now declares--text-color-destructive: hsl(var(--destructive-text, var(--destructive)))..darkdefines--destructive-text(0 91% 71%). Light theme leaves it unset, sotext-destructivefalls back to--destructiveand is byte-identical in what it renders; a host theme that sets--destructivekeeps working in light mode.bg-,border-,ring-destructiveand--destructive-foregroundare untouched, so red buttons look the same in both themes.text-destructivein the repo (and itshover:/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.mdxnames 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@themewith Tailwind and assertstext-destructivereads--text-color-destructivewhilebg-/border-destructiveread--color-destructive;:rootleaves--destructive-textunset; 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
Tests 13 passed (13).origin/main, run, restored withgit checkout HEAD --,git diff HEADempty):Tests 7 failed | 6 passed (13).pnpm --dir ui exec vitest run packages/components/ packages/plugin-gantt/ packages/cli/src/__tests__/app-generator.test.tsexit 0:Test Files 590 passed | 2 skipped (592),Tests 5587 passed | 138 skipped (5725).pnpm --filter @object-ui/components type-checkexit 0 after building its dependency closure;tsc -p tsconfig.test.json --listFilesOnlylists the new test file.Acceptance notes
@themeand.darkhunks ofpackages/components/src/index.css; the same two hunks inapps/console/src/index.css(the console's iOS dark surfaces are the ones measured below).text-destructiveis 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.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.claude/project-thread-0wa2pw(the claim names it), notclaude/issue-35658-….Verification
Measured in the running console (examples/app-showcase backend,
ui/apps/consoleVite dev serving this tree; Chromium, system theme emulated light and dark, Accounts list). Before = the three stylesheets fromorigin/main8c18a362; after = head. Ratio = WCAG 2 contrast of the computed text colour on its composed backdrop.rgb(127, 29, 29)onrgb(26, 26, 30)1.73:1rgb(248, 114, 114)onrgb(26, 26, 30)6.31:1rgb(39, 39, 43)1.49:1rgb(248, 250, 252)onrgb(127, 29, 29)9.58:1rgb(239, 68, 68)on white 3.76:1, hovered 3.22:1Screenshots (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 --ranat head00cc92e4: 71 derived, 71 run, 0 NOT-MEASURED, every recorded exit 0. 68 of them were run on05a265c1(same tree except the new test's comment stripping, which now goes throughscripts/js-comment-mask.mjsaftercheck-hand-rolled-comment-maskflagged the hand-rolled regex);check:skill-examples(exit 3 first:packages/specnot yet built),check:doc-formula-expressionsandpnpm --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 intoorigin/main8c18a362.05a265c1; the stylesheets are byte-identical at the head.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01L6bhgTTFr43A9SHzSvgUoy