Color.CMYK
(Color v0.4.0)
Copy Markdown
Device CMYK color space. This is the simple "subtractive from sRGB" device CMYK — it does NOT use an ICC profile, so it is not suitable for color-accurate print workflows. For that, pass the sRGB (or AdobeRGB) struct through a real CMS.
All channels are unit floats in [0, 1].
Summary
Types
A simple subtractive CMYK colour. Each of c, m, y, k is a
unit float in [0.0, 1.0]. No ICC profile is implied — this is
device-independent CMYK suitable for device-cmyk() interchange,
not for press output.
Functions
Converts an sRGB color to CMYK.
Converts a CIE XYZ color to CMYK via sRGB.
Converts a CMYK color to sRGB.
Converts a CMYK color to CIE XYZ via sRGB.
Types
@type t() :: %Color.CMYK{ alpha: Color.Types.alpha(), c: float() | nil, k: float() | nil, m: float() | nil, y: float() | nil }
A simple subtractive CMYK colour. Each of c, m, y, k is a
unit float in [0.0, 1.0]. No ICC profile is implied — this is
device-independent CMYK suitable for device-cmyk() interchange,
not for press output.
Functions
Converts an sRGB color to CMYK.
Arguments
srgbis aColor.SRGBstruct.
Returns
- A
Color.CMYKstruct.
Examples
iex> {:ok, cmyk} = Color.CMYK.from_srgb(%Color.SRGB{r: 0.0, g: 0.0, b: 1.0})
iex> {cmyk.c, cmyk.m, cmyk.y, cmyk.k}
{1.0, 1.0, 0.0, 0.0}
Converts a CIE XYZ color to CMYK via sRGB.
Converts a CMYK color to sRGB.
Arguments
cmykis aColor.CMYKstruct.
Returns
- A
Color.SRGBstruct.
Examples
iex> {:ok, srgb} = Color.CMYK.to_srgb(%Color.CMYK{c: 0.0, m: 0.0, y: 0.0, k: 0.0})
iex> {srgb.r, srgb.g, srgb.b}
{1.0, 1.0, 1.0}
iex> {:ok, srgb} = Color.CMYK.to_srgb(%Color.CMYK{c: 1.0, m: 1.0, y: 0.0, k: 0.0})
iex> {srgb.r, srgb.g, srgb.b}
{0.0, 0.0, 1.0}
Converts a CMYK color to CIE XYZ via sRGB.