typestyle / csx

Utility functions for TypeStyle
https://typestyle.github.io
MIT License
102 stars 14 forks source link

merge hsl and hsla into one function #87

Closed xialvjun closed 5 years ago

xialvjun commented 5 years ago
/**
 * Creates a color from hue, saturation, and lightness.  Alpha is automatically set to 100%
 */
export declare function hsl(hue: number, saturation: string | number, lightness: string | number): ColorHelper;
/**
 * Creates a color from hue, saturation, lightness, and alpha
 */
export declare function hsla(hue: number, saturation: string | number, lightness: string | number, opacity: string | number): ColorHelper;

// merge them into one function... Same is rgb and rgba...
export declare function hsla(hue: number, saturation: string | number, lightness: string | number, opacity?: string | number): ColorHelper;
notoriousb1t commented 5 years ago

If these were to be merged, I think it would make sense to merge them into hsl rather than hsla since that matches the functional notation of HSL. I am open to a PR for this if you want to contribute one (which I will approve quickly), but I don't have have a lot of time allotted to OSS this month, so otherwise, it might be a few weeks until I can get to this change.

Let me know if you want to do a PR for it, the same goes for doing so for RGB.

notoriousb1t commented 5 years ago

Actually, I have another ticket in CSX to push out, so I will address this shortly.

notoriousb1t commented 5 years ago

Added in 697dd6362a1c7bdd18873d76ca0e99cc5191ac41. I will close this when I am able to roll out those changes.

notoriousb1t commented 5 years ago

This was published in https://github.com/typestyle/csx/releases/tag/v10.0.0. Please take a look and let me know if that works for you.

xialvjun commented 5 years ago

Yeah, thanks.