Find the closest Tailwind color
find_closest_tailwind_colorFinds the Tailwind default palette shade matching any CSS color, so you can use a standard class like bg-red-500 instead of an arbitrary value. If visibly different, create a custom palette.
Instructions
Finds the shade in Tailwind's default palette that looks most like a given color, e.g. #db4d53 -> red-500. Use it to pick an existing Tailwind class (bg-red-500) instead of an arbitrary value. If the difference is visible, use generate_palette to add the exact color as a custom palette instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| color | Yes | Any CSS color: hex (#db4d53), rgb(), hsl(), oklch() or a named color | |
| tailwindVersion | No | The project's Tailwind CSS major version. Defaults to 4 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Tailwind color name, e.g. "red" | |
| input | Yes | The input color | |
| shade | Yes | Closest shade, e.g. 500 | |
| distance | Yes | OKLab distance: 0 is identical, under 0.02 is hard to see | |
| className | Yes | Color part of a utility class, e.g. "red-400" for bg-red-400 | |
| tailwindValue | Yes | Tailwind's value for that shade | |
| tailwindVersion | Yes | ||
| visiblyDifferent | Yes | True when the Tailwind shade looks different from the input |