Tint.HSV (Tint v1.1.0) View Source

A color in the HSV (hue, saturation, value) colorspace.

Link to this section Summary

Functions

Converts a tuple containing hue, saturation and value into a Tint.HSV struct.

Determines whether the given color is a grayscale color which basically means that saturation or the value is 0.

Checks whether the hue of the given color is in the specified bounds. This can be used to cluster colors by their chromaticity.

Builds a new HSV color from hue, saturation and value color parts. Please always use this function to build a new HSV color.

Converts HSV color into a tuple containing the hue, saturation and value parts.

Link to this section Types

Specs

t() :: %Tint.HSV{hue: float(), saturation: float(), value: float()}

Link to this section Functions

Specs

from_tuple(
  {number() | String.t(), number() | String.t(), number() | String.t()}
) :: t()

Converts a tuple containing hue, saturation and value into a Tint.HSV struct.

Link to this function

grayscale?(color)

View Source (since 1.0.0)

Specs

grayscale?(t()) :: boolean()

Determines whether the given color is a grayscale color which basically means that saturation or the value is 0.

Link to this function

hue_between?(color, min, max)

View Source (since 1.0.0)

Specs

hue_between?(t(), min :: number(), max :: number()) :: boolean()

Checks whether the hue of the given color is in the specified bounds. This can be used to cluster colors by their chromaticity.

Link to this function

new(hue, saturation, value)

View Source

Specs

new(number() | String.t(), number() | String.t(), number() | String.t()) :: t()

Builds a new HSV color from hue, saturation and value color parts. Please always use this function to build a new HSV color.

Examples

iex> Tint.HSV.new(25.8, 0.882, 1)
#Tint.HSV<25.8°,88.2%,100%>

Specs

to_tuple(t()) :: {float(), float(), float()}

Converts HSV color into a tuple containing the hue, saturation and value parts.