Color.AdobeRGB (Color v0.4.0)

Copy Markdown

Adobe RGB (1998) color space, using the Lindbloom Adobe working space (primaries from Adobe RGB (1998) specification, D65 reference white) and simple gamma companding with γ = 2.19921875.

Channels r, g, b are unit floats in [0, 1].

Summary

Functions

Converts a CIE XYZ color (assumed D65/2°) to Adobe RGB.

Converts an Adobe RGB color to a CIE XYZ color.

Types

t()

@type t() :: %Color.AdobeRGB{
  alpha: number() | nil,
  b: number() | nil,
  g: number() | nil,
  r: number() | nil
}

Functions

from_xyz(xyz)

Converts a CIE XYZ color (assumed D65/2°) to Adobe RGB.

Arguments

Returns

Examples

iex> xyz = %Color.XYZ{x: 0.95047, y: 1.0, z: 1.08883, illuminant: :D65, observer_angle: 2}
iex> {:ok, adobe} = Color.AdobeRGB.from_xyz(xyz)
iex> {Float.round(adobe.r, 3), Float.round(adobe.g, 3), Float.round(adobe.b, 3)}
{1.0, 1.0, 1.0}

to_xyz(adobe_rgb)

Converts an Adobe RGB color to a CIE XYZ color.

Arguments

Returns

  • A Color.XYZ struct tagged with D65/2°, Y ∈ [0, 1].

Examples

iex> {:ok, xyz} = Color.AdobeRGB.to_xyz(%Color.AdobeRGB{r: 1.0, g: 1.0, b: 1.0})
iex> {Float.round(xyz.x, 4), Float.round(xyz.y, 4), Float.round(xyz.z, 4)}
{0.9505, 1.0, 1.0888}