xyY
The xyY color space is not registered in Color
by default
Properties
Name: xyy
White Point: D65 / 2˚
Coordinates:
Name | Range* |
---|---|
x | [0, 1] |
y | [0, 1] |
Y | [0, 1] |
* Space is not bound to the range and is used to define percentage inputs/outputs.
A derivative of the CIE 1931 XYZ space, the CIE xyY color space, is often used as a way to graphically present the chromaticity of colors.
Tip
The color space, as implemented, is relative to the D65 white point, meaning it is created from XYZ D65. If colors are needed relative to different white points, the color space can be subclassed. If proper chromaticity coordinates are desired for a given color, you can checkout the API for chromaticity coordinates.
Channel Aliases
Channels | Aliases |
---|---|
x | |
y | |
Y |
Input/Output
The xyY space is not currently supported in the CSS spec, the parsed input and string output formats use the color()
function format using the custom name --xyy
:
color(--xyy x y Y / a) // Color function
The string representation of the color object and the default string output use the color(--xyy x y Y / a)
form.
>>> Color("xyy", [0.64, 0.33, 0.21264])
color(--xyy 0.64 0.33 0.21264 / 1)
>>> Color("xyy", [0.50047, 0.4408, 0.48173]).to_string()
'color(--xyy 0.50047 0.4408 0.48173)'
Registering
from coloraide import Color as Base
from coloraide.spaces.xyy import xyY
class Color(Base): ...
Color.register(xyY())