XYZColor
Details
- XYZColor is a color space defined in terms of standard responses to a power spectrum. It was the first standard quantitative color space and allows for objective comparison of colors.
- XYZColor is device independent and corresponds to the CIE 1931
color space. - ColorConvert can be used to convert XYZColor to other color spaces.
- The parameters are defined as:
-
x 
color, combination of green and red y 
approximate luminance z 
color, approximately blue - The functions
,
and
are the CIE standard human observer color-matching functions,
is the spectral power distribution, and
is the wavelength in nanometers. - XYZColor allows any non-negative real number for x, y, and z; negative values will be clipped.
- RGBColor approximately corresponds to x between 0 and 0.97, y between 0 and 1, and z between 0 and 0.83.
- If no opacity has been specified, XYZColor[x,y,z] is equivalent to XYZColor[x,y,z,1].
- XYZColor[x,y,z,a] is equivalent to {XYZColor[x,y,z],Opacity[a]}.
- The alternative forms XYZColor[{x,y,z}] and XYZColor[{x,y,z,a}] can also be used. »
- {XYZColor[…], p1, …} indicates that graphics primitives pi should be displayed in the color given.
- The following wrappers can be used around colors:
-
ColorsNear[color,…] specifies a region around color Directive[…,color,…] specifies a color in combination with other directives » Glow[XYZColor[…]] specifies color independent of lighting » Opacity[a,color] specifies a color with an opacity a Style[expr,XYZColor[…]] displays expr with the specified color » - For 3D surfaces, explicit XYZColor directives define surface colors; the final shading depends on lighting and contributions from specularity and glow. »
Examples
open all close allBasic Examples (4)
Specify the color of graphics primitives:
Graphics[{XYZColor[1, 0, 1], Disk[]}]Specify the color with opacity:
Graphics3D[{XYZColor[1, 0, 1], Sphere[]}]Specify the output color of expressions:
Style[x ^ 2 + y ^ 2, XYZColor[1, 0, 1]]Plot[Sin[x ^ 2], {x, 0, 2Pi}, PlotStyle -> XYZColor[1, 0, 1]]Scope (3)
Colors in 3D (1)
Graphics3D[{XYZColor[.4, 1, 0], Sphere[]}]Use diffuse and specular surface color:
Graphics3D[{XYZColor[.4, 1, 0], Specularity[White, 20], Sphere[]}]Use glow color, setting the diffuse surface color to black:
Graphics3D[{Black, Glow[XYZColor[.4, 1, 0]], Sphere[]}]Color Operations (2)
Use Blend to mix two or more colors:
{Graphics[{XYZColor[1, 0, 0], Disk[]}], Graphics[{Blend[{XYZColor[1, 0, 0], XYZColor[0, 0, 1]}], Disk[]}],
Graphics[{XYZColor[0, 0, 1], Disk[]}]}Use Lighter and Darker to mix with white and black, respectively:
{Graphics[{Lighter[XYZColor[0.4, 0.2, 0.1], .4], Disk[]}],
Graphics[{XYZColor[0.4, 0.2, 0.1], Disk[]}],
Graphics[{Darker[XYZColor[0.4, 0.2, 0.1], .4], Disk[]}]}Generalizations & Extensions (2)
XYZColor[{X,Y,Z}] is equivalent to XYZColor[X,Y,Z]:
{Graphics[{XYZColor[{1, 1, 0}], Disk[]}], Graphics[{XYZColor[1, 1, 0], Disk[]}]}Map[Graphics[{XYZColor[#], Disk[]}]&, {{1, 0, 1}, {1, 1, 0}, {0, 1, 0}}]Table[Graphics[{Orange, Disk[{1, 0}], Opacity[a], XYZColor[1, 1 / 2, 0], Disk[]}], {a, 0, 1, .33}]Use the opacity argument in XYZColor directly:
Table[Graphics[{Orange, Disk[{1, 0}], XYZColor[1, 1 / 2, 0, a], Disk[]}], {a, 0, 1, .33}]Tech Notes
Related Guides
Text
Wolfram Research (2014), XYZColor, Wolfram Language function, https://reference.wolfram.com/language/ref/XYZColor.html (updated 2021).
CMS
Wolfram Language. 2014. "XYZColor." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2021. https://reference.wolfram.com/language/ref/XYZColor.html.
APA
Wolfram Language. (2014). XYZColor. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/XYZColor.html
BibTeX
@misc{reference.wolfram_2026_xyzcolor, author="Wolfram Research", title="{XYZColor}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/XYZColor.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_xyzcolor, organization={Wolfram Research}, title={XYZColor}, year={2021}, url={https://reference.wolfram.com/language/ref/XYZColor.html}, note=[Accessed: 13-June-2026]}