Primitive Color CIE XYZ (MD)
Feed it CIE XYZ coordinates, get a hex color
- int
- HEX
CIE XYZ is the grandfather color space - the one all the other color models are defined against. You will basically never pick a color in XYZ by feel, which is exactly why this node exists: when a measurement, a research paper, or a colorimeter hands you X/Y/Z coordinates, mdPrimitiveColorXYZ turns them into a packed RGB integer and a #RRGGBB hex string so the number becomes usable in your graph.
How it works
The node converts XYZ to linear sRGB using the standard D65 matrix (the white point the defaults are built around), applies the sRGB gamma curve, then clamps and packs the result as (R << 16) | (G << 8) | B. The default values are worth a look: X = 0.95047, Y = 1.0, Z = 1.08883. Those are the D65 reference white coordinates - leave them as-is and you get pure white, which is a handy sanity check the first time you use it.
The inputs and outputs
X/Y/Z- 0 to 1, with the D65 white-point defaults above. Y is luminance, X and Z carry the chromaticity.- Output
int- packed color integer (0–16777215). - Output
HEX- hex string.
Install
Standard MdColorMod - no dependencies, no models:
cd ComfyUI/custom_nodes
git clone https://github.com/MdONeilsl/ComfyUI-MdColorMod
Restart ComfyUI, or install via ComfyUI Manager by searching "MdColorMod".
Where people get burned
The trap is gamut: XYZ covers colors that sRGB screens can't display, and anything outside the sRGB gamut clips to the nearest displayable edge. A legitimately measured color can come out looking like a flat or wrong shade on screen - that's the conversion hitting the limits of the output space, not a bug. Also note the white point: this is D65 (daylight). If your coordinates came from a measurement taken under a different illuminant, the hex will look off. And as always with the primitive color nodes, the int output feeds color-INT inputs - it's a value, not an image.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| X | FLOAT | 0.9500–1 | X coordinate in CIE XYZ color space. |
| Y | FLOAT | 1.0000–1 | Y coordinate in CIE XYZ color space. |
| Z | FLOAT | 1.0890–1 | Z coordinate in CIE XYZ color space. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| int | INT | Packed 24-bit integer color value (0-16777215). |
| HEX | STRING | Hexadecimal color string (e.g., #FF0000). |