View Source Ultraviolet.Color.LCH (Ultraviolet v0.1.1)
Functions for working in the LCH / HCL colorspace.
Summary
Functions
Converts from an RGB Color struct to a LCH struct.
Generates a new LCH color
Generates a new LCH color
Generates a new LCH color
Converts from LCH to an RGB Color struct
Types
Defines the channels in a LCH color.
Functions
@spec from_rgb(Ultraviolet.Color.t(), list()) :: {:ok, t()}
Converts from an RGB Color struct to a LCH struct.
Options
:reference
: the CIE Lab white reference point. Default::d65
:round
: an integer if rounding L, a, and b channel values to N decimal places is desired; if no rounding is desired, passfalse
. Default:2
Generates a new LCH color
iex>Ultraviolet.Color.LCH.new({0.5, 0.0, 60})
{:ok, %Ultraviolet.Color.LCH{h: 60, c: 0.0, l: 0.5}}
Generates a new LCH color
iex>Ultraviolet.Color.LCH.new(0.5, 0.0, 60)
{:ok, %Ultraviolet.Color.LCH{h: 60, c: 0.0, l: 0.5}}
Generates a new LCH color
iex>Ultraviolet.Color.LCH.new(0.5, 0.0, 60, 0.5)
{:ok, %Ultraviolet.Color.LCH{h: 60, c: 0.0, l: 0.5, a: 0.5}}
@spec to_rgb(t(), list()) :: {:ok, Ultraviolet.Color.t()}
Converts from LCH to an RGB Color struct
Options
:reference
: the CIE Lab white reference point. Default::d65
:round
: an integer if rounding r, g, and b channel values to N decimal places is desired; if no rounding is desired, passfalse
. Default:0