Skip to content

fix: readable icon and text colours on accent backgrounds - #1179

Open
Klakurka wants to merge 1 commit into
masterfrom
ccr-b62297cf-awgd35-icon-contrast
Open

Klakurka wants to merge 1 commit into
masterfrom
ccr-b62297cf-awgd35-icon-contrast

Conversation

@Klakurka

@Klakurka Klakurka commented Dec 3, 2026

Copy link
Copy Markdown
Member

Related to #1133

Description

I couldn't open the issue's screenshot from my environment. Two contrast problems on /payments match its description (a small crop of an icon on a button):

  1. Invoice icon buttons (New / Edit / View invoice). The buttons set background: none inline. The global button:enabled:hover rule uses !important, so it overrides that and paints them accent blue on hover. The hover filter that tints the icon blue then puts a blue icon on a blue background, and it nearly disappears. For example, "+" becomes a blue circle with an almost invisible blue plus.
  2. White text and icons on the accent blue in dark mode. The accent #669cfe with white text is 2.7:1, which fails WCAG AA. The hover colour #417ded with white is 3.9:1, which also fails. This affected:
    • the active or hovered Filters / Clear buttons, where the dark-mode icon is also inverted to white
    • active filter chips
    • Button hovers
    • the table's button chips
    • table pagination
    • the back button

Changes:

  • styles/variables.css: new tokens for both themes:
    • --on-accent-color: #231f20: text and icons on the accent background, 6.0:1
    • --hover-accent-bg-color: #4f8bfb: hover background, 5.0:1 with that text
  • Light mode was already using dark text on the accent, so this applies the same approach to dark mode. The sidebar MenuItem already does this for its active item.
  • styles/global.css: the global button hover, back button, table button chips and pagination hover use the new tokens.
  • components/Button/button.module.css: hover uses the new hover background.
  • pages/payments/payments.module.css:
    • Filters/Clear hover and active state use dark text, and the icon is no longer inverted on the accent background.
    • Active chips use dark text.
    • Invoice icon buttons stay transparent on hover, so only the icon is tinted. In dark mode the icon's white inversion is dropped on hover, so it turns accent blue like in light mode.
  • pages/dashboard/dashboard.module.css: the same filter-button fix, and the period toggle hover uses --on-accent-color (it was #fff).

--accent-color and --hover-accent-color are unchanged, so the landing page, which uses --hover-accent-color with white text, looks the same.

Test plan

  • I rendered the real variables.css, global.css, payments.module.css and button.module.css from master and from this branch in a static harness with Playwright/Chromium. I took screenshots in light and dark themes, at rest and while hovering Filters, a Button (default and small) and the invoice icons.
    • Before: the "+" and pencil invoice icons turned into solid blue blocks with an invisible icon on hover. In dark mode, the Filters / chips / hovered buttons had white text on #669cfe.
    • After: the invoice icons stay on a transparent background and only turn blue. All accent backgrounds have dark text and icons in both themes.
  • Contrast ratios worked out with the WCAG formula: #231f20 on #669cfe is 6.0:1, and on #4f8bfb it is 5.0:1. Before, white on #669cfe was 2.7:1 and white on #417ded was 3.9:1.
  • Not checked in the running app (no DB/SuperTokens here). Please check /payments (filters, invoice column), /dashboard (filters, period toggles) and a few forms in both themes.
  • CSS only. No unit tests were affected.

Remarks

  • The plain button { color: var(--primary-text-color) } default is unchanged. Many buttons override the background without setting a text colour, so changing it globally could make text unreadable elsewhere. Only hover and accent states use the new tokens.
  • Not changed here: in light mode, the dashboard's active period toggle has accent-coloured text on white, which is 2.9:1. Fixing it needs a design decision on the accent colour.

Generated by Claude Code

On /payments the invoice icon buttons were painted accent blue on hover by
the global button hover rule (it overrides their inline `background: none`),
and the blue-tinted icon on top almost vanished. In dark mode, white text
and icons sat on the accent blue (#669cfe, 2.7:1) for active/hovered
filters, the Clear/Filters buttons, button chips and table pagination.

- Add `--on-accent-color` (#231f20, 6.0:1 on the accent) and
  `--hover-accent-bg-color` (#4f8bfb, 5.0:1) for both themes.
- Global button hover, Button component hover, back button, table chips and
  pagination hover use them.
- Payments/dashboard filter buttons: dark text and an un-inverted icon on
  the accent background.
- Invoice icon buttons stay transparent on hover; only the icon is tinted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019G564i2sNiHJYQR95m8zGq
@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 51 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5e1b64ec-6bd4-43c3-89b6-d1db0282248b
Commits

Reviewing files that changed from the base of the PR and between f9d06f2 and c401a03.

Files selected for processing: 5

  • components/Button/button.module.css
  • pages/dashboard/dashboard.module.css
  • pages/payments/payments.module.css
  • styles/global.css
  • styles/variables.css
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

This branch has not been deployed

No deployments
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.

2 participants