| Graphics::Toolkit::Color::Manual::Space(3) | User Contributed Perl Documentation | Graphics::Toolkit::Color::Manual::Space(3) |
NAME
Graphics::Toolkit::Color::Manual::Space - details about supported color spaces
SYNOPSIS
GTC supports 33 color spaces. This manual page lists them all and displays their name, alias name, family name, axis names (long, short and role) and all other properties that might help GTC users, like shape, gamma, white point and so on. These terms are explained here. Some sections about a specific color space are enriched by useful background information and historical context. See a condensed overview of the color spaces, sorted by family at the CheatSheet.
INTRODUCTION
Color spaces are mathematical-geometrical constructs that associate each color with a point inside a coordinate system. The numerical values of a color definition are viewed as coordinates associated with the axes that express different properties. The closer two colors are along an axis the more similar they are in that property. That is also why the ordering of the values does matter. Axes have a canonical order which in most cases is reflected in the space name. The values have to be in that same order. For the majority of spaces, axes have a long name, often an English word, and a short name that is one letter. More often than not the first character of the long name is the short name.
All color spaces are finite and only certain value ranges along an axis are acceptable. In other words: there is a mandatory minimum and maximum value for each axis. A normal axis simply has an associated minimum value of zero and maximum of one. Color definitions that do not obey this restriction are out of gamut (is_in_gamut). And while there might be sometimes subtle differences between value range and gamut, these are no subject of consideration here.
Almost all spaces have 3 dimensions (axes), only CMYK has four. And most spaces are completely linear like in Euclidean (everyday) geometry, but some spaces are cylindrical. That means only two axes are straight lines and one is angular (circle shaped), because the associated value describes an angle. Some spaces have additional constraints about their shape. For instance "HSV" has the shape of a cone and not of a cylinder and also "HWB" is not a cylinder since the sum of whiteness and blackness should never exceed 100%.
While the author acknowledges that some of the spaces below should be called systems to be technically correct, they still will be called spaces here, because one goal of this software is a seamless interoperability between them.
FAMILY
Another approach to heighten the interoperability is to group them into families of similar spaces. Every family has a representative color space, which lends its name as family name. The other members of the family need to provide a way to map their axes to the axes of the representative. This is achieved either by having the same long axis names (like HSL and OKHSL) or by assigning a role name to each axis. For instance the chroma axis of the LCH space has the role name saturation so GTC can treat the chroma the same way as an HSL saturation value. The spaces on this page are grouped by family (for better orientation), but not every color space belongs to a family, hence the chapter "Other".
ORDER
Please note the ordering of spaces within each family. That corresponds to the internal search order. That means if you define a color with values in hash format, a HASH reference with values under the keys of red, green and blue, they will be understood as standard "RGB" values. RGB is also the first entry here for the RGB family. This is especially noteworthy since many operations default to OK-type spaces like OKLAB or OKHSL, but CIELAB and HSL are higher in search order.
SYNTAX
Whenever a color space name is used within a color definition, it has to be written as shown here in the chapter headings. But there is a rather great degree of freedom to write the name in various ways. First of all the name and its alias can be used synonymously by the user. Only when GTC writes a color definition, it never uses alias names. Secondly, upper and lower case are acceptable. Although some formats will force the output to be in a certain casing style. Thirdly, there is a list of acceptable, special characters as: underscore '_', dash '-', whitespace ' ' and dot '.'. They might be inserted into names to write them like 'BT.2020', but that's optional.
TERMS
The "SYNTAX" section already explained the relation between a name and alias name and the section before laid out what a space "FAMILY" is and why there is the concept of an axis role. The "INTRODUCTION" told about long and short axes names, axis ranges, normal ranges and gamut. Large gamut just means a space encompasses more colors than other spaces. The whitepoint is the set of values that represent pure white in a certain space. The conversion between spaces is always a mathematical algorithm, but some conversions are simpler than others. Some are fulfilled by just one operation. There the values of the color are taken as vector that gets multiplied with a conversion matrix to obtain the values in the target space. And sometimes conversions consist just of scaling, where a gamma value gets applied to every color value: "$value = $value ** $gamma". In some cases there are some additional operations to smooth out the edges of the curve. But in any case this procedure is called transfer function.
RGB family
RGB
(alias name is SRGB - standard RGB) is the default color space of this module internally and for input and output. It is used by most computer hardware like monitors and follows the logic of additive color mixing as produced by an overlay of three colored light beams. The sum of all colors will be white, as opposed to subtractive mixing. RGB is a completely Cartesian (Euclidean) 3D space and thus an RGB tuple consists of three integer values:
red (short r) range: 0 .. 255, green (short g) range: 0 .. 255 and blue (short b) range: 0 .. 255. A higher value means that a stronger amount of that base color flows into the mix that is displayed on a black background. Therefore black is (0, 0, 0), white (255, 255, 255) and a pure red (fully saturated color) is (255, 0, 0). RGB has a gamma of 2.4, but a piecewise transfer function, which is clipped at the corners (around the normalized values of zero and one).
LinearRGB
(alias name is LinRGB) Same as "RGB" but with normal value ranges (0 .. 1) and removed piecewise gamma correction. That means there is a linear correlation between the shown values and the RGB brightness of the pixel on the screen without any adaptation to human sensibilities. Its alias name is LinRGB.
CIEXYZ
this space (alias XYZ) has the axis X, Y and Z (long and short axis names are this time the same), that refer to the red, green and blue receptors (cones) in the retina (on the back side of the eye). Because those cones measure a lot more left and right than just exactly those colors, they got these technical names. The values in that space tell you about the amount of chemical and neurological activity a color produces inside the eye. The values ranges are always from zero and reach 95.047 on the "X" - axis, 100 on "Y" and 108.883 on "Z", due to the used white point of D65 which has these values divided by 100. The illuminant D65 is standard for all CIE spaces except CIERGB.
CIERGB
1931 standardized, normal valued (0 .. 1) space with same axis as "RGB": red (r), green (g) and blue (b). It has the illuminant E and no gamma (linear RGB).
AdobeRGB
(alias name opRGB) is a normalized "RGB" variant with the CIE white point D65 a gamma of about 2.2.
AppleRGB
normal "RGB" variant with white point of D65 and gamma is 1.8. It is the legacy color space Apple used in the 90ies.
ProPhotoRGB
(alias name ROMMRGB) normal "RGB" variant with a white point of D50, gamma = 1.8 and a wide gamut.
WideGamutRGB
Even greater gamut then previous spaces with white point D50 and gamma of ~2.2.
Display P3
wide gamut RGB variant with same gamma function as "RGB", has alias name P3.
Display P3 Linear
P3 variant without any gamma - wider gamut variant of \LinearRGB.
DCI-P3
Simply Display P3 Linear with a gamma of 2.4, has alias name SMPTE P3.
DCI-P3 Linear
DCI variant without gamma
Rec.709
RGB space, has alias name BT.709.
Rec.2020
RGB space, has alias name BT.2020.
LAB family
CIELAB
(alias LAB) is a derivate of "CIEXYZ" that reorders the colors along axis that reflect how the brain processes them. It uses three information channels. One named L (lightness) with a real value range of (0 .. 100). Second is channel a, that reaches from red to green (-500 .. 500) and thirdly b from yellow to blue (-200 .. 200). Values will be displayed with three decimals. The long names of the axis names contain a '*' and are thus: L*, a* and b*. The a and b axis reflect the opponent color theory.
HunterLAB
predecessor of "CIELAB" by Richard S. Hunter with no alias name and slightly different color transitions on yellow-blue-direction. The axis have same long and short names: L with normal values (0 .. 1), a -172.30 .. 172.30 and b -67.20 .. 67.20.
CIELUV
(alias LUV) is a more perceptually uniform version of "CIELAB" and the axis a and b got renamed to u and v (see "YUV") but did not change their meaning. It has also three Cartesian dimension named L*, u* and v*, (short names have only the first letter of these names). They have real valued ranges, which are 0 .. 100, -134 .. 220 and -140 .. 122.
OKLAB
is a modern improvement of "CIELAB" by Bjoern Ottosson with no alias name and for nicer color transitions and better numeric behaviour. The axis long names are same as the same ones: L with values (0 .. 1), a and b with both (-0.5 .. 0.5). If you want to use it like in CSS, just add "range => [100, [-120,120], [-120,120]], suffix => '%'".
YIQ
Is a space developed for NTSC to broadcast a colored television signal, which is still compatible with black and white TV. It achieves this by sending the luminance (short y) (sort of brightness with real range of 0 .. 1) in channel number one, which is all black and white TV needs. Additionally we have the axis of in-phase (short i) (cyan - orange - balance, range -0.5959 .. 0.5959) and quadrature (short q) (magenta - green - balance, range: -0.5227 .. 0.5227).
YPbPr
Is a slightly altered version of YIQ for the PAL TV standard. We use a variant called YUV, which can also be used as space name. It has computation friendly value ranges and is still relevant in video and image formats and compression algorithms, but under the name YCbCr. The only difference is that YCbCr works with digital values but this module computes with real (analogue) values to enable any precision the user might prefer. To make this clear, this space holds the name YPbPr. It has three Cartesian axis: 1. luma (short y) with a real value range of 0..1, 2. Pb (short u, -0.5 .. 0.5) and 3. Pr (short v, -0.5 .. 0.5). (see also "CIELUV")
HSL family
HSL
.. is a cylindrical space that orders colors along cognitive properties. The first dimension is the angular one and it rotates in 360 degrees around the rainbow of fully saturated colors: 0 = red, 15 approximates orange, 60 - yellow 120 - green, 180 - cyan, 240 - blue, 270 - violet, 300 - magenta, 330 - pink. 0 and 360 points to the same coordinate. This module only outputs 0, even if accepting 360 as input. The second, linear dimension (axis) measures the distance between a point the center column of the cylinder at the same height, no matter in which direction. The center column has the value 0 (white .. gray .. black) and the outer mantle of the cylinder contains the most saturated, purest colors. The third, vertical axis reaches from bottom value 0 (always black no matter the other values) to 100 (always white no matter the other values). In summary: HSL needs three integer values: hue (short h) (0 .. 360), saturation (short s) (0 .. 100) and lightness (short l) (0 .. 100).
OKHSL
OKHSL is a variant of HSL for perceptual uniformity by Bjoern Ottosson. It has no alias name and the same axis names: hue (short h) (0 .. 360), saturation (short s) (0 .. 1) and lightness (short l) (0 .. 1).
CIELCHab
(alias LCH) is the cylindrical version of the "CIELAB" with the dimensions luminance, chroma and hue - in short l, c and h, with the roles of lightness, saturation and hue. The real valued ranges are from zero to 100, 539 and 360 respectively. Like with the "HSL" and "HSV", hue is the circular dimension and its value is meant as degrees in a circle. For gray colors in the middle column the value hue has no importance and will in this implementation always be zero.
CIELCHuv
(alias LCHuv) is the cylindrical version of the "CIELUV" and works similar to CIELCHab except the real valued range of chroma is (0 .. 261) and the space has no alias name.
OKLCH
is the cylindrical variant of "OKLAB" just parallels "CIELCHab". The axis names are again: luminance, chroma and hue - in short: l, c and h with the roles of lightness, saturation and hue. Value ranges are similar as in "OKLAB": luminance 0 .. 1 (normal), chroma 0 .. 0.5 and hue are angles of 0 .. 360 degrees. Also if you prefer a CSS compatible format, use "range => [100, 120, 360]" and a preferred suffix.
HSV family
HSV
... is also cylindrical but is shaped like a cone. Similar to HSL we have hue and saturation, but the third axis is named value (short v). In HSL we always get white, when lightness is 100. In HSV additionally saturation has to be zero to get white. When saturation is 100 and value is 100 we have the purest, most saturated color of whatever hue sets. So unlike in "HSL", here every color has its unique coordinates.
HSB
Is an alias to "HSV", just the value axis is renamed with brightness (b).
OKHSV
OKHSL is a variant of HSV for percepual uniformity. It has no alias name and the same axis names: hue (short h) (0 .. 360), saturation (short s) (0 .. 1) and value (short v) (0 .. 1).
HWB family
HWB
An inverted "HSV", where the saturated, pure colors are on the center column of the cylinder. It still has the same circular hue dimension with an integer range of 0 .. 360. The other two, linear dimensions (also 0 .. 100 integer range with optional suffix '%') are whiteness (w) and blackness (b). They describe how much white or black are mixed into the pure hue. If both are zero, you get a pure color. whiteness of 100 always leads to white and blackness of 100 always leads to black. The space is truncated as a cone so the sum of whiteness and blackness can never be greater than 100.
NCol
Is a more human readable variant of the "HWB" space with an altered hue values, that consists of a letter and two digits. The letter demarks one of the six areas around the rainbow. R is Red, Y (Yellow), G (Green), C (Cyan), B (Blue), M (Magenta). The two digits after this letter are an angular value, measuring the distance between the pure color (as stated by the letter) and the described color (toward the next color on the rainbow). The whiteness and blackness axis have integer values with the suffix '%', since they are percentual values as well.
OKHWB
OKHWB is a variant of HWB for percepual uniformity. It has no alias name and the same axis names: hue (short h) (0 .. 360), whiteness (short w) (0 .. 1) and blackness (short b) (0 .. 1).
Other
CMY
is the opposite of "RGB" since it follows the logic of subtractive color mixing as used in printing. Think of it as the amount of colored ink on white paper, so that white is (0,0,0) and black (1,1,1). It uses normalized real value ranges: 0 .. 1. An CMY tuple has also three values:
cyan (short c) is the inverse of red, magenta (short m ) is inverse to green and yellow (short y) is inverse of blue.
CMYK
is an extension of "CMY" with a fourth value named key (short k), which is the amount of black ink mixed into the CMY color. It also has an normalized range of 0 .. 1. This should not bother you since you are free to change the range at your preference.
AUTHOR
Herbert Breunung, <lichtkind@cpan.org>
COPYRIGHT
Copyright 2026 Herbert Breunung.
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| 2026-06-21 | perl v5.42.2 |