TinyColor.HSL (tiny_color v0.1.1)

Represents a color in the for of red, green, blue, and optional alpha

Link to this section Summary

Functions

Returns a string representation of this color. hex is only supported if alpha == 1.0

Link to this section 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)"