View Source Ultraviolet.Color.OKLab (Ultraviolet v0.1.1)
Functions for working with the OKLab color space.
Uses the :d65
reference illuminant.
Summary
Functions
Converts from sRGB to OKLab.
Generates a new OKLab color
Generates a new OKLab color
Generates a new OKLab color
Converts from OKLab to sRGB.
Types
Defines the channels in an OKLab color.
Functions
@spec from_rgb(Ultraviolet.Color.t(), list()) :: {:ok, t()}
Converts from sRGB to OKLab.
Options
: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 OKLab color
iex>Ultraviolet.Color.OKLab.new({0.5, 0.0, 0.0})
{:ok, %Ultraviolet.Color.OKLab{l_: 0.5, a_: 0.0, b_: 0.0}}
Generates a new OKLab color
iex>Ultraviolet.Color.OKLab.new(0.5, 0.0, 0.0)
{:ok, %Ultraviolet.Color.OKLab{l_: 0.5, a_: 0.0, b_: 0.0}}
Generates a new OKLab color
iex>Ultraviolet.Color.OKLab.new(0.5, 0.0, 0.0, 0.5)
{:ok, %Ultraviolet.Color.OKLab{l_: 0.5, a_: 0.0, b_: 0.0, a: 0.5}}
@spec to_rgb(t(), list()) :: {:ok, Ultraviolet.Color.t()}
Converts from OKLab to sRGB.
Options
: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