TinyColor.HSL (tiny_color v0.3.0)
Represents a color in the for of red, green, blue, and optional alpha
Summary
Functions
Returns a string representation of this color. hex is only supported if alpha == 1.0
Functions
Link to this function
new(hue, saturation, lightness, alpha \\ 1.0)
Link to this function
percentages(hsl)
Link to this function
to_string(struct, type \\ nil)
Returns a string representation of this color. hex is only supported if alpha == 1.0
Examples
iex> TinyColor.HSL.to_string(%TinyColor.HSL{hue: 128.0, saturation: 47.0, lightness: 50.0})
"hsl(128, 47%, 50%)"
iex> TinyColor.HSL.to_string(%TinyColor.HSL{hue: 128.0, saturation: 47.0, lightness: 50.0, alpha: 0.5})
"hsla(128, 47%, 50%, 0.5)"
iex> TinyColor.HSL.to_string(%TinyColor.HSL{hue: 128.0, saturation: 47.0, lightness: 50.0}, :hsla)
"hsla(128, 47%, 50%, 1.0)"
iex> TinyColor.HSL.to_string(%TinyColor.HSL{hue: 128.0, saturation: 47.0, lightness: 50.0, alpha: 0.5}, :hsla)
"hsla(128, 47%, 50%, 0.5)"