tints.dev icon indicating copy to clipboard operation
tints.dev copied to clipboard

Clamp lightness values to prevent out of range hex codes and null values

Open courdek opened this issue 5 months ago • 1 comments

Fixes #82

In the UI there is value for a user in being able to set lightness/luminance maximum and minimum values beyond the boundaries permitted by the standard. It allows a palette range to be widened so the ends are not near white/black.

The end values used in the calculations however need to be clamped in order to prevent hex codes beyond 255.

In an earlier PR the hue and saturation were clamped. This PR simply applies that to lightness/luminance as well. Additionally adding a safety clamp at the HSLtoRGB helper level.

Awesome project! Found this to be much more useful than many of the other tailwind palette generators out there. cheers!

courdek avatar Sep 06 '24 20:09 courdek