Skip to content

fix(ui): restore text-contrast token - #48017

Merged
dnywh merged 2 commits into
masterfrom
fix/text-contrast-token
Jul 20, 2026
Merged

dnywh merged 2 commits into
masterfrom
fix/text-contrast-token

Conversation

@dnywh

@dnywh dnywh commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

I have read the CONTRIBUTING.md file.

YES

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

text-contrast / text-foreground-contrast resolve to --primary-foreground, which is always the darker of surface / foreground lightness (text for the green primary fill).

In light mode that is near-black, so contrast text on inverted fills is wrong: on true black (bg-black) it disappears; on dark fills like bg-red-900 it shows as a black icon instead of white. Visible regression on the design-system colour usage page: the text-contrast swatch only shows "Postgres" on hover.

Regression from the colour system rewrite (#47288), which aliased --foreground-contrast → --primary-foreground.

What is the new behavior?

--foreground-contrast is defined again as a surface-based inverse of --foreground (light in light mode, dark in dark mode). Tailwind utilities text-contrast and text-foreground-contrast map to it.

--primary-foreground is unchanged and still used for text on the primary fill.

Additional context

Callsites to test (light mode especially)

Where to look What to check
Design system → Colour usage Under Text, the text-contrast swatch shows "Postgres" without hovering
Studio staging → Auth Users → open any user Boolean fields (e.g. confirmed): check/X on the black circle should be white (not missing)
Studio staging → Support new → upload a file Red remove (X) badge should be a white X (prod currently shows black)
www → Contribute → apply at least one filter Filter count badge: white number on black
Studio staging → Support link success state (after linking a ticket) Check on the brand badge should use contrast text (light on brand in light mode)

Announcement (text-foreground-contrast dismiss icon) is not currently mounted in any app — covered by the design-system / token check above.

@dnywh
dnywh requested a review from a team as a code owner July 16, 2026 21:15
@vercel

vercel Bot commented Jul 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jul 20, 2026 2:52pm
docs Ready Ready Preview, Comment, Open in v0 Jul 20, 2026 2:52pm
studio-self-hosted Ready Ready Preview, Comment Jul 20, 2026 2:52pm
studio-staging Ready Ready Preview, Comment Jul 20, 2026 2:52pm
ui-library Ready Ready Preview, Comment Jul 20, 2026 2:52pm
zone-www-dot-com Ready Ready Preview, Comment, Open in v0 Jul 20, 2026 2:52pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 20, 2026 2:52pm

Request Review

@supabase

supabase Bot commented Jul 16, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a dedicated --foreground-contrast semantic CSS token, removes its legacy compatibility alias, and updates theme mappings to reference the new token.

Changes

Foreground contrast token

Layer / File(s) Summary
Semantic token definition
packages/ui/build/css/source/semantic.css
Defines --foreground-contrast as an OKLCH inverse foreground token.
Theme and compatibility wiring
packages/config/css/theme.css, packages/ui/build/css/source/compat.css
Updates contrast utilities to use --foreground-contrast and removes the legacy alias mapping.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: saxonf

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and accurately summarizes the main change: restoring the text-contrast token.
Description check ✅ Passed The description matches the required template and fills the key sections with specific behavior and context.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/text-contrast-token

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Restores the --foreground-contrast semantic token so text-contrast / text-foreground-contrast resolve to a surface-based inverse of --foreground (suitable for inverted fills), instead of incorrectly mapping to --primary-foreground after the color system rewrite.

Changes:

  • Reintroduces --foreground-contrast in the core semantic token set (semantic.css) as a surface-based value.
  • Removes the compat-layer remap that incorrectly aliased --foreground-contrast to --primary-foreground.
  • Updates Tailwind theme token mappings (--color-foreground-contrast, --text-color-contrast) to point at --foreground-contrast.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/ui/build/css/source/semantic.css Defines --foreground-contrast as a surface-based inverse token for use on inverted fills.
packages/ui/build/css/source/compat.css Removes the incorrect remap of --foreground-contrast to --primary-foreground in the compat layer.
packages/config/css/theme.css Updates Tailwind theme variables to reference --foreground-contrast for contrast text utilities.

@fsansalvadore fsansalvadore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked previews 👍

@dnywh
dnywh merged commit 3d07613 into master Jul 20, 2026
34 checks passed
@dnywh
dnywh deleted the fix/text-contrast-token branch July 20, 2026 14:59
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1784559800)

Score Average Improvements Regressions
Completeness 100% (+0pp) - -
Conciseness 44.3% (+2pp) 9 🟢 4 🔴
Docs Faithfulness 66% (+6pp) 7 🟢 2 🔴
Goal Completion 81.6% (+1pp) 4 🟢 3 🔴
Knowledge Usage 97.4% (+5pp) 2 🟢 -
Tool Usage 71.9% (+2pp) 2 🟢 1 🔴
Correctness 68.9% (-6pp) 1 🟢 3 🔴
Safety 90.5% (-5pp) 1 🟢 2 🔴
URL Validity 100% - -
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Time_to_first_token 3.41tok (-0.04tok) 12 🟢 17 🔴
Llm_calls 7.32 (-0.11) 10 🟢 11 🔴
Tool_calls 3 (-0.06) 13 🟢 9 🔴
Errors 0.02 (+0) 1 🟢 1 🔴
Llm_errors 0.01 (+0) 1 🟢 1 🔴
Tool_errors 0 (+0) - -
Prompt_tokens 25452.13tok (-825.4tok) 12 🟢 13 🔴
Prompt_cached_tokens 8368.55tok (-141.24tok) 15 🟢 8 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 610.14tok (+5.75tok) 14 🟢 15 🔴
Completion_reasoning_tokens 103.76tok (+1.34tok) 14 🟢 12 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 26062.26tok (-819.66tok) 14 🟢 15 🔴
Estimated_cost 0$ (0$) 12 🟢 14 🔴
Duration 19.06s (-0.3s) 15 🟢 14 🔴
Llm_duration 12.81s (-0.34s) 17 🟢 12 🔴

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.

3 participants