Skip to content

🐛 fix(theme): accent and danger text read 4.5:1 everywhere (--accent-text, --danger-text) (#129) - #137

Merged
Cemoche merged 7 commits into
mainfrom
issue-129-text-tokens
Oct 21, 2026
Merged

Cemoche merged 7 commits into
mainfrom
issue-129-text-tokens

Conversation

@Cemoche

@Cemoche Cemoche commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Closes #129

Summary

--accent and --danger used as text read below 4.5:1 on several backgrounds: accent at 4.02 light / 4.24 dark, danger down to 3.40. Two new text tokens fix this. Both keep the base hue and reach ≥ 4.5:1 on every background they sit on, in LIGHT, DARK_MEDIA and DARK_FORCED:

Token Light Dark Worst case (--sel)
--accent-text #0057B5 #92B6FA 4.67 / 4.63
--danger-text #AD2323 #FF9999 4.66 / 4.62
  • Text uses switched: 48 text-danger and 3 text-accent uses across 28 files. --accent and --danger stay for tints, rings, borders and outlines.
  • Grid FK indicator (↗):
    • plain rows use --accent-text;
    • deleted rows use the row's text colour;
    • edited cells use the best text on --modified (white in dark, 5.11:1).
  • Grid failed rows:
    • a failed plain row's text is --danger-text;
    • on the insert / delete fills, no red reaches 4.5:1 in dark, so the fill's text is kept;
    • every failed row now shows a red row number instead (6.33 / 7.59 on --grid-head; a selected row's number stays white).
  • Tailwind 4 conflict (pre-existing): four controls had both text-text / text-icon and text-danger* in one class string, and the neutral colour won. The affected controls were query Cancel, SSL Browse, connection delete and the safe-mode button. They now use colourless base classes plus exactly one colour.
  • Guards (src/styles/textColor.test.ts):
    • no --accent / --danger text colour remains, in class, inline or CSS form;
    • text_colour_conflict_guard: no class string combines two base text-<colour> utilities. Before the fix it flagged exactly the four controls.
  • Contrast tests: tokens.test.ts checks every text token on every background it sits on.
  • Docs: amendment Contrast: --accent used as text (links, FK indicator) is under 4.5:1 #129 in spec §5.1, and the colour rules in src/CLAUDE.md (text tokens, one base text colour per class string).

Follow-ups filed from the review: #135 (focus rings and accent controls under 3:1) and #136 (text on the grid's change fills under 4.5:1).

No Rust change.

How it was tested

$ pnpm exec vitest run --maxWorkers=1     # 109 files, 1369 tests passed
$ pnpm exec tsc --noEmit                  # clean

Manual check list (light, then dark: OS dark and Settings > forced dark)

  1. Table tab with a foreign key: follow an FK link (Mod+click) so the breadcrumb appears. Its links show in the darker blue (light) or pale blue (dark), and stay readable on hover.
  2. Row detail panel (open a row on an FK column): the "→ table" link buttons are readable at rest and on hover.
  3. Structure tab > Foreign keys: the referenced-table links are readable.
  4. Grid:
    • The ↗ FK indicator on plain and zebra rows uses the new blue.
    • Select an FK column (header): the indicator stays readable on the grey selection.
    • Select a row: the indicator is white.
    • Mark a row for deletion: the indicator is grey like the row's text.
  5. Grid failed change:
    • Make an UPDATE fail (for example a constraint): the row's text turns red, while the edited cell stays yellow with dark text (light) or white text (dark).
    • Make an INSERT fail: the green row keeps its normal text, and the error shows in the pending changes panel and the notice.
  6. Errors on each surface:
    • A dialog error (rename query with an empty name).
    • The palette load error.
    • A Settings shortcut collision.
    • The connection form "Test" failure.
    • A failed object load in the sidebar, with hover.
    • A history entry error, with hover.
    • A page popover with an invalid limit.
    • A filter SQL preview error.
    • A query error in the results panel.
    • ConfirmRunDialog's "Run" button, with hover.
    • The dialog danger button (outline style), with hover.
  7. Unchanged look: aria-invalid red borders on fields, focus rings, and checkboxes.
  8. After the review round:
    • Run a long query: Cancel is red.
    • Make the SSL CA… browse fail (no file portal): the button turns red.
    • An existing connection's trash icon is red.
    • Make a safe-mode save fail: the toolbar icon turns red.
    • Make an INSERT and a DELETE fail: their row numbers are red, while their cells keep the fill's text; a selected failed row's number is white.
    • Edit an FK cell: in dark, ↗ shows white on the yellow fill.

Checklist

  • pnpm test green
  • pnpm lint green (tsc; no Rust change, clippy in CI)
  • pnpm test:rust green (not applicable: no src-tauri/ change)
  • No secret, token, real password or private key in the diff
  • User-visible strings in src/lib/strings.ts
  • Commits follow <emoji> <type>(<scope>): <description>

🤖 Generated with Claude Code

Cemoche and others added 7 commits October 21, 2026 04:34
…kground they sit on

--accent as text reads 4.02:1 (light) / 4.24:1 (dark); --danger falls under
4.5:1 on --seg-sel, --sel and dark --btn / --pill. New text tokens, same
hues: --accent-text #0057B5 / #92B6FA, --danger-text #AD2323 / #FF9999,
tested on every background their uses sit on in light, dark media and
dark forced (#129).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ic guard

Every text-accent / text-danger becomes text-accent-text /
text-danger-text (links, error messages, destructive labels, icons drawn
through text-*). textColor.test.ts refuses --accent or --danger as a text
colour in src/ (classes with any variant, important, opacity or
arbitrary-value form, inline styles, CSS) (#129).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ext where they read

linkColor reads --accent-text; a deleted row's indicator follows its
text. A failed row's text is --danger-text on plain rows; on an inserted
or deleted row the fill keeps its text, and an edited cell of a failed
row keeps --modified with the text that reads on it (#129).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…-text

Spec §5.1 amendment (#129) with the token values and the ratios per
background; src/CLAUDE.md colour rule and the fill guard's comment point
to the text tokens.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
… red

Tailwind 4 orders .text-text and .text-icon after .text-danger-text, so
query Cancel, SSL Browse (failed pick), the connection delete button and
the safe mode button (failed save) never showed red. Their shared styles
get a colourless base (btnBase, buttonBaseClass, iconButtonBaseClass,
iconButtonBase) and each button one colour. textColor.test.ts refuses a
class string with two base text colours, through constants and imports
(#129).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…an edited cell

Every failed row keeps a red cue: its row number in --danger-text on
--grid-head (6.33:1 light / 7.59:1 dark), white when selected. An edited
cell's FK indicator takes the text that reads best on --modified (the
dark --accent-text was 2.51:1 there) (#129).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Cemoche
Cemoche merged commit 69f74da into main Oct 21, 2026
6 checks passed
@Cemoche
Cemoche deleted the issue-129-text-tokens branch October 21, 2026 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Contrast: --accent used as text (links, FK indicator) is under 4.5:1

1 participant