Function Repository Resource:

ConformColors

Source Notebook

Create a list of colors of the same type and same number of arguments

Contributed by: Sander Huisman

ResourceFunction["ConformColors"][{col1, col2, }]

returns a list of colors coli with common color spaces and argument counts.

ResourceFunction["ConformColors"][{col1, col2, }, colspace]

uses the specified colorspace.

Details

ResourceFunction["ConformColors"] always adds alpha channel information such that all colors have the same number of arguments.
The colspace can be "RGB", "CMYK", "Grayscale", "HSB", "XYZ", "LAB", "LCH", or "LUV".
By default, the color space of the first color is used.

Examples

Basic Examples (1) 

Turn all the colors to the color space of the first color:

In[1]:=
conformed = ResourceFunction[
  "ConformColors"][{CMYKColor[0.3, 0.5, 0.7, 0.1], RGBColor[0.2, 0.3, 0.4], GrayLevel[0.3], Red, Blue}]
Out[1]=
In[2]:=
InputForm /@ conformed
Out[2]=

Scope (1) 

Provide a destination color space:

In[3]:=
conformed = ResourceFunction[
  "ConformColors"][{RGBColor[0.2, 0.3, 0.4], GrayLevel[0.3], Red, Blue}, "CMYK"]
Out[3]=
In[4]:=
InputForm /@ %
Out[4]=

Publisher

SHuisman

Version History

  • 1.0.0 – 16 September 2022

Related Resources

License Information