yields True if color is a valid color directive and False otherwise.


  • ColorQ tests whether an expression is a valid color that can be used for styling graphics primitives or used with images as padding, background and more.
  • ColorQ returns True for any valid color directive specified in any of the following color spaces:
  • GrayLevelgray level specifying the brightness
    RGBColorstandard sRGB
    Huehue, saturation, brightness
    XYZColorCIE 1931
    LABColorCIE 1976
    LUVColorCIE 1976


open allclose all

Basic Examples  (2)

A valid color:

An expression with a color directive head that is not a valid color:

Scope  (2)

A valid RGBColor:

A valid RGBColor with transparency:

Validate an array of color directives:

Generalizations & Extensions  (1)

ColorQ works on expressions where color components are specified as a list:

Applications  (2)

Select colors from a list:

Define a function with custom behavior on colors and images:

Test the function on an image:

Test the function on a list of colors:

The function is unevaluated on other kinds of inputs:

Possible Issues  (1)

Unevaluated expressions that correspond to valid colors still give True:

However, if the expression is not yet a valid color, ColorQ will not evaluate it:

This is also true for expressions that need an evaluation to be marked as numerical:

Compare with the results from RealValuedNumberQ:

Wolfram Research (2014), ColorQ, Wolfram Language function,


Wolfram Research (2014), ColorQ, Wolfram Language function,


Wolfram Language. 2014. "ColorQ." Wolfram Language & System Documentation Center. Wolfram Research.


Wolfram Language. (2014). ColorQ. Wolfram Language & System Documentation Center. Retrieved from


@misc{reference.wolfram_2024_colorq, author="Wolfram Research", title="{ColorQ}", year="2014", howpublished="\url{}", note=[Accessed: 25-July-2024 ]}


@online{reference.wolfram_2024_colorq, organization={Wolfram Research}, title={ColorQ}, year={2014}, url={}, note=[Accessed: 25-July-2024 ]}