HSLuv (HSLuv v0.2.1) View Source

Convert colors between HSLuv and RGB color spaces

Link to this section Summary

Link to this section Functions

Link to this function

distance_line_from_origin(arg)

View Source
Link to this function

length_of_ray_until_intersect(theta, arg)

View Source
Link to this function

max_safe_chroma_for_l(l)

View Source
Link to this function

max_safe_chroma_for_lh(l, h)

View Source

Create an HSLuv color from values

Both integer and floats are supported.

  • h must be between 0 and 360 included
  • s must be between 0 and 100 included
  • l must be between 0 and 100 included

Create an HSLuv color from RGB values

Both integer and floats are supported.

  • r must be between 0 and 255 included
  • g must be between 0 and 255 included
  • b must be between 0 and 255 included

Examples

iex> HSLuv.rgb(200, 150, 20)
%HSLuv{h: 57.26077539223336, l: 65.07659371178795, s: 97.61326139925325}

Convert RGB to HSLuv.

Examples

iex> HSLuv.to_hsluv(20, 50, 20)
{127.71501294923954, 67.94319276530133, 17.829530512200364}

Convert HSLuv to RGB.

  • h must be between 0 and 360 included
  • s must be between 0 and 100 included
  • l must be between 0 and 100 included

Returned components are between 0 and 255 included

Examples

iex> HSLuv.to_rgb(20, 50, 20)
{75, 38, 31}