tailwindcss/packages/tailwindcss
Robin Malfait e46b3d74ee
Canonicalization: make hex colors case insensitive (#20298)
This PR fixes an issue where hex-based colors in arbitrary properties
and values were considered case-sensitive even though they are
case-insensitive in CSS.

If you look at the linked issue, there is this input CSS:
```css
@theme {
  --color-brand-purple: #3f3cbb;
}
```

We expect that both `bg-[#3f3cbb]` and `bg-[#3F3CBB]` get canonicalized
to `color-brand-purple` but before this pr, only the first one would get
canonicalized that way (since it's a perfect match).

Technically a bunch more values are case-insensitive but a lot of them
_are_ sensitive so to get this 100% correct, a lot more parsing needs to
happen. I think we can start with this and expand the logic when needed.

Fixes: #20295

## Test plan

1. Added a regression test based on the linked issue
2. Added tests for arbitrary properties (`[color:#fff]` vs
`[color:#FFF]`), and tests for arbitrary properties (`bg-[#fff]` vs
`bg-[#FFF]`)
2026-07-02 00:04:44 +02:00
..
src Canonicalization: make hex colors case insensitive (#20298) 2026-07-02 00:04:44 +02:00
tests Bump dependencies (#19608) 2026-02-04 12:38:50 +01:00
index.css introduce v4 codebase 2024-03-05 14:29:15 +01:00
package.json 4.3.2 (#20281) 2026-06-29 10:10:00 -04:00
playwright.config.ts Bump dependencies (#20095) 2026-05-21 17:58:55 +02:00
preflight.css Center the dropdown icon added to an input with a paired datalist in Chrome (#18511) 2025-07-15 14:41:04 -04:00
README.md docs: update package README CI badge to main (#19692) 2026-02-18 11:52:07 +01:00
theme.css Add mauve, olive, mist, and taupe color palettes (#19627) 2026-02-18 11:52:35 +01:00
tsconfig.json Bump dependencies (#19957) 2026-04-24 21:21:12 +02:00
tsup.config.ts Revert: Only expose used CSS variables (#16403) 2025-02-10 13:26:13 +01:00
utilities.css introduce v4 codebase 2024-03-05 14:29:15 +01:00
vitest.config.ts Reduce precision of oklab() arguments in test snapshots (#15210) 2024-11-27 11:06:19 -05:00

Tailwind CSS

A utility-first CSS framework for rapidly building custom user interfaces.

Build Status Total Downloads Latest Release License


Documentation

For full documentation, visit tailwindcss.com.

Community

For help, discussion about best practices, or feature ideas:

Discuss Tailwind CSS on GitHub

Contributing

If you're interested in contributing to Tailwind CSS, please read our contributing docs before submitting a pull request.