Skip to content

theme: enforce bundled contrast and chart palettes#7

Merged
BumpyClock merged 6 commits into
mainfrom
fix/theme-contrast-chart-palettes
Jul 16, 2026
Merged

theme: enforce bundled contrast and chart palettes#7
BumpyClock merged 6 commits into
mainfrom
fix/theme-contrast-chart-palettes

Conversation

@BumpyClock

@BumpyClock BumpyClock commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Description

Enforce a 4.5:1 text contrast floor across bundled themes, define five-color chart palettes that remain visible against each theme background, and preserve distinct semantic interaction states after contrast adjustments.

Validation now checks:

  • text and semantic foregrounds at 4.5:1 or better
  • every chart palette defines all five colors
  • chart colors at 3:1 or better against the resolved theme background
  • pairwise chart separation using composited OKLab distance
  • scoped normal/hover/active separation for interaction states changed by this PR

AI-assisted implementation. Generated changes were reviewed and validated against every bundled theme.

Screenshot

Not applicable. Theme data and validation coverage only.

Break Changes

None.

How to Test

  • cargo fmt --all -- --check
  • cargo test -p gpui-component theme::tests:: -- --nocapture
  • cargo build
  • cargo clippy -- --deny warnings

Checklist

  • Reviewed the changes and confirmed AI-generated code is accurate.
  • Passed cargo run for story tests related to the changes.
  • Platform-specific testing is not applicable; theme parsing and color validation are platform-independent.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 58 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 36f8b630-9d97-4c6f-af92-ec7747cd7458

📥 Commits

Reviewing files that changed from the base of the PR and between b5345d6 and 3c00ca5.

📒 Files selected for processing (20)
  • crates/ui/src/theme/default-theme.json
  • crates/ui/src/theme/tests.rs
  • themes/adventure.json
  • themes/alduin.json
  • themes/ayu.json
  • themes/catppuccin.json
  • themes/everforest.json
  • themes/flexoki.json
  • themes/gruvbox.json
  • themes/harper.json
  • themes/hybrid.json
  • themes/jellybeans.json
  • themes/kibble.json
  • themes/macos-classic.json
  • themes/mellifluous.json
  • themes/molokai.json
  • themes/solarized.json
  • themes/spaceduck.json
  • themes/tokyonight.json
  • themes/twilight.json

Walkthrough

Bundled themes receive foreground color corrections and five-entry chart palettes. Test-only validation loads every theme, checks text contrast, and verifies chart color presence, parsing, and uniqueness.

Changes

Theme validation and palette updates

Layer / File(s) Summary
Theme validation tests
crates/ui/src/theme/mod.rs, crates/ui/src/theme/tests.rs
Registers test helpers that load bundled themes, calculate contrast ratios, and validate chart palettes.
Foreground color adjustments
themes/*.json
Updates muted, primary, status, and informational foreground colors across theme variants.
Chart palette expansion
themes/*.json
Adds chart.1 through chart.5 entries to bundled theme variants.

Estimated code review effort: 3 (Moderate) | ~25 minutes

🚥 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 Concise and specific: it captures the main change by enforcing bundled theme contrast and chart palettes.
Description check ✅ Passed Mostly matches the template with Description, Screenshot, Break Changes, How to Test, and Checklist, but omits the Closes #[issue number] line.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/theme-contrast-chart-palettes

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/ui/src/theme/tests.rs`:
- Around line 112-119: Add the baseline foreground/background pair to the
`pairs` array in the contrast test, using `colors.foreground` with
`colors.background`, so normal application text is validated against the 4.5:1
contrast floor while preserving the existing token checks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 277cdf03-1e26-4670-a4af-da1595198246

📥 Commits

Reviewing files that changed from the base of the PR and between 95e4b03 and b5345d6.

📒 Files selected for processing (22)
  • crates/ui/src/theme/mod.rs
  • crates/ui/src/theme/tests.rs
  • themes/adventure.json
  • themes/alduin.json
  • themes/ayu.json
  • themes/catppuccin.json
  • themes/everforest.json
  • themes/fahrenheit.json
  • themes/flexoki.json
  • themes/gruvbox.json
  • themes/harper.json
  • themes/hybrid.json
  • themes/jellybeans.json
  • themes/kibble.json
  • themes/macos-classic.json
  • themes/matrix.json
  • themes/mellifluous.json
  • themes/molokai.json
  • themes/solarized.json
  • themes/spaceduck.json
  • themes/tokyonight.json
  • themes/twilight.json

Comment thread crates/ui/src/theme/tests.rs
@BumpyClock

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@BumpyClock

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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.

1 participant