Color.Tristimulus (Color v0.12.1)

Copy Markdown

Authoritative source of illuminant reference white data.

This module is the single source of truth for every CIE illuminant the library supports — :A, :B, :C, :D50, :D55, :D65, :D75, :E, :F2, :F7, :F11, plus the LED, ID and DCI series — and for the two CIE standard observer angles (2 and 10). It is consulted by:

Reference whites for the 11 most common illuminants at the 2° observer come directly from Bruce Lindbloom's tables and are reproduced exactly. The remaining illuminants are computed from CIE 1931 / CIE 1964 chromaticities.

All values are returned as plain lists or tuples of float() — the module has no Nx dependency.

Summary

Functions

Returns the supported CIE standard observer angles.

Returns the reference white for an illuminant as a three-element list [Xr, Yr, Zr] of floats.

Returns the reference white for an illuminant as an {Xr, Yr, Zr} tuple of plain floats, suitable for feeding into Color.Conversion.Lindbloom.

Functions

illuminants()

observer_angles()

@spec observer_angles() :: [2 | 10]

Returns the supported CIE standard observer angles.

Examples

iex> Color.Tristimulus.observer_angles()
[2, 10]

reference_white(options \\ [])

Returns the reference white for an illuminant as a three-element list [Xr, Yr, Zr] of floats.

Arguments

  • options is a keyword list.

Options

  • :illuminant defaults to :D65.

  • :observer_angle defaults to 2.

Returns

  • A list of three floats.

reference_white_tuple(options \\ [])

Returns the reference white for an illuminant as an {Xr, Yr, Zr} tuple of plain floats, suitable for feeding into Color.Conversion.Lindbloom.

Arguments

  • options is a keyword list.

Options

  • :illuminant is the illuminant atom (for example :D65, :D50). Defaults to :D65.

  • :observer_angle is the observer angle in degrees, 2 or 10. Defaults to 2.

Returns

  • An {Xr, Yr, Zr} tuple of floats.

Examples

iex> Color.Tristimulus.reference_white_tuple(illuminant: :D65)
{0.95047, 1.0, 1.08883}

tristimulus()

tristimulus(illuminant, observer_angle)

validate_illuminant(illuminant)

validate_observer_angle(observer_angle)