TinyColor.HSV (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, value, alpha \\ 1.0)

Link to this function

percentages(hsv)

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.HSV.to_string(%TinyColor.HSV{hue: 128.0, saturation: 47.0, value: 50.0})
"hsv(128, 47%, 50%)"

iex> TinyColor.HSV.to_string(%TinyColor.HSV{hue: 128.0, saturation: 47.0, value: 50.0, alpha: 0.5})
"hsva(128, 47%, 50%, 0.5)"

iex> TinyColor.HSV.to_string(%TinyColor.HSV{hue: 128.0, saturation: 47.0, value: 50.0}, :hsva)
"hsva(128, 47%, 50%, 1.0)"

iex> TinyColor.HSV.to_string(%TinyColor.HSV{hue: 128.0, saturation: 47.0, value: 50.0, alpha: 0.5}, :hsva)
"hsva(128, 47%, 50%, 0.5)"