[Toolkit][Shadcn] Make the rich color toasts of Sonner opaque in dark mode by Kocal · Pull Request #4117 · symfony/ux · GitHub
Skip to content

[Toolkit][Shadcn] Make the rich color toasts of Sonner opaque in dark mode - #4117

Merged
Kocal merged 1 commit into
symfony:3.xfrom
Kocal:toolkit-sonner-opaque-rich-colors
Oct 19, 2026
Merged

Kocal merged 1 commit into
symfony:3.xfrom
Kocal:toolkit-sonner-opaque-rich-colors

Conversation

@Kocal

@Kocal Kocal commented Oct 19, 2026

Copy link
Copy Markdown
Member
Q A
Bug fix? yes
New feature? no
Deprecations? no
Documentation? no
Issues Fix #4094
License MIT

With richColors, a toast in dark mode uses dark:bg-green-900/20 (and the same for red, amber and blue). The background is only 20% opaque, so stacked toasts and the page show through it, and the text is hard to read.

The fix mixes the same tint into the page background with color-mix(), for example dark:bg-[color-mix(in_oklab,var(--color-green-900)_20%,var(--background))]. The toast is now opaque and looks the same over the page.

A new test reads the background alpha of each rich toast in dark mode. The existing screenshots still match.

Background alpha (dark mode)
Before 51 / 255
After 255 / 255

… mode

| Q              | A
| -------------- | ---
| Bug fix?       | yes
| New feature?   | no
| Deprecations?  | no
| Documentation? | no
| Issues         | Fix symfony#4094
| License        | MIT

With `richColors`, a toast in dark mode uses `dark:bg-green-900/20` (and the same for red, amber and blue). The background is only 20% opaque, so stacked toasts and the page show through it, and the text is hard to read.

The fix mixes the same tint into the page background with `color-mix()`, for example `dark:bg-[color-mix(in_oklab,var(--color-green-900)_20%,var(--background))]`. The toast is now opaque and looks the same over the page.

A new test reads the background alpha of each rich toast in dark mode. The existing screenshots still match.

| | Background alpha (dark mode) |
| --- | --- |
| Before | 51 / 255 |
| After | 255 / 255 |
@Kocal Kocal self-assigned this Oct 19, 2026
@carsonbot carsonbot added Bug Bug Fix Toolkit Status: Needs Review Needs to be reviewed labels Oct 19, 2026
@Kocal
Kocal merged commit 68a53ac into symfony:3.x Oct 19, 2026
48 checks passed
@Kocal
Kocal deleted the toolkit-sonner-opaque-rich-colors branch October 19, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Bug Fix Status: Needs Review Needs to be reviewed Toolkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Toolkit][Shadcn] Sonner: rich color toasts are see-through in dark mode

2 participants