Skip to content

Add a --mode option to the contrast checker - #371

Merged
Jeremy-Walton merged 4 commits into
mainfrom
add-contrast-mode-option
Oct 22, 2026
Merged

Jeremy-Walton merged 4 commits into
mainfrom
add-contrast-mode-option

Conversation

@Jeremy-Walton

@Jeremy-Walton Jeremy-Walton commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Task

[OP-XXX](link to ticket) No ticket. Follow-up to #368.

Why?

Apps that force one color mode get contrast failures for the mode their users never see, so they have to filter --report output to run the checker in CI. The new --mode option checks only light or dark mode, so those apps can call optics-check-contrast directly.

This PR also carries the vite bump from #369, so it ships in 2.6.1.

What Changed

  • Add --mode=light and --mode=dark to the contrast checker; both modes stay the default
  • Show the mode in the summary line, and stop with exit code 2 on an unknown mode
  • Document --mode and each option's default on the Contrast Checker page
  • Bump vite from 8.1.4 to 8.1.6, a development dependency
  • Bump the version to 2.6.1, with a changelog entry

Quality Assurance

  • Have you tagged the PR with the correct labels?
  • Have you validated the changes?
    • Have you run linters? (yarn sanity-check)
    • Have you run prettier?
    • Have you tried building the css?
    • Have you tried building storybook?
  • [ ] Have you updated any usage of changed tokens?
  • [ ] Did you add a component?
    • [ ] Have you added it to the dependency graph?
    • [ ] Have you added it to the docs?
  • [ ] Did you update a component?
    • [ ] Have you updated the dependency graph?
    • [ ] Have you updated the docs?
  • Do you need to update the package version?
    • Did you update the example pages in .storybook/assets?
  • [ ] Were any changes made to the top level optics.css file?
    • [ ] Were those changes reflected in the other top level files?

Screenshots

None. No UI changes.

Jeremy-Walton and others added 2 commits October 22, 2026 16:19
optics-check-contrast takes --mode=light or --mode=dark to check only one
color mode. Apps that force one mode no longer need to filter --report
output to ignore the other. Both modes are still checked by default, and an
unknown mode exits with 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jeremy-Walton Jeremy-Walton self-assigned this Oct 22, 2026
@Jeremy-Walton Jeremy-Walton added Theme Tokens Changes to the theme tokens documentation Improvements or additions to documentation labels Oct 22, 2026
@Jeremy-Walton
Jeremy-Walton force-pushed the add-contrast-mode-option branch from f8d341e to ab0876b Compare October 22, 2026 20:21
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 8.1.4 to 8.1.6.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/v8.1.6/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.1.6/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.1.6
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jeremy-Walton Jeremy-Walton added the dependencies Pull requests that update a dependency file label Oct 22, 2026
@Jeremy-Walton
Jeremy-Walton force-pushed the add-contrast-mode-option branch from ab0876b to 42a11f5 Compare October 22, 2026 20:24
@Jeremy-Walton
Jeremy-Walton merged commit 0632bb5 into main Oct 22, 2026
4 checks passed
@Jeremy-Walton
Jeremy-Walton deleted the add-contrast-mode-option branch October 22, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation Theme Tokens Changes to the theme tokens

Development

Successfully merging this pull request may close these issues.

2 participants