Skip to content

Conversation

@APlusTotalgut
Copy link

Summary

Extend fromTailwind() to support all Tailwind color-related prefixes and add alpha handling.

Details

  • Added support for all Tailwind color prefixes such as bg-, border-, text-, fill-, and stroke-, following the official documentation:
    https://tailwindcss.com/docs/colors#using-color-utilities
  • Implemented alpha parsing so classes with / (e.g., bg-green-500/40) are supported — only when followed by a number or when using white or black.
  • transparent, current, and inherit now return the lastValidColor instead of producing an invalid color.
  • When alpha is below 50%, text color automatically switches to black for better contrast.
  • Added luminance-based calculation for more accurate color adaptation and readability.

Impact

Improves the versatility and accuracy of fromTailwind() when parsing color utilities,
enabling proper handling of prefixes and alpha transparency.

@vercel
Copy link

vercel bot commented Oct 24, 2025

@APlusTotalgut is attempting to deploy a commit to the jaleelb's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant