Function Repository Resource:

Swatch

Source Notebook

Look up 6,414 named colors comprising 2,861 distinct colors

Contributed by: Ed Pegg Jr

ResourceFunction["Swatch"][name]

returns the named color corresponding to name.

ResourceFunction["Swatch"][name, prop]

returns the prop value associated with name.

ResourceFunction["Swatch"][color, n]

returns the n nearest named colors to color as rules of the form colornamecolor.

ResourceFunction["Swatch"]["Dataset", n]

returns all database entries having at least n source citations.

Details

Color names can have varying levels of disagreement, with orange being easy and fuchsia being difficult. Different sources may assign different colors to the same name. ResourceFunction["Swatch"] returns one selected digital value for each name.
Color names are matched without regard to capitalization, spaces, hyphens, punctuation or diacriticals.
ResourceFunction["Swatch"] allows various properties values, prop:
"Hex"hexadecimal RGB specification
"CMYK"color converted to CMYKColor
"Source"list of sources that attest the named color
"ValueSource"source used for the selected RGB value
The database contains historical, dictionary, web, survey, manufacturer and specialist color names:
KeySourceColors
ISCCISCC-NBS Dictionary of Color Names5089
M&PMaerz and Paul — A Dictionary of Color3014
PlocherePlochere Color System1238
RidgwayRidgway — Color Standards and Color Nomenclature1076
XKCDXKCD Color Survey923
TaylorTaylor, Knoche and Granville — Descriptive Color Names Dictionary669
RepertoireRépertoire de couleurs525
CNLColor Name List379
Repertoire-scanRépertoire de couleurs — digitized plates336
RHSRoyal Horticultural Society colour references198
HortHorticultural colour references197
TCCATextile Color Card Association182
CSSCSS Color Module Level 4148
Wiki-geologicWikipedia — Geologic time scale (ICS colours)181
WernerWerner's Nomenclature of Colours110
MWMerriam-Webster74
FedPaintISCC-NBS ready-mixed paint names65
DerwentDerwent colour charts56
SaccardoSaccardo — Chromotaxia50
Saccardo-scanSaccardo — digitized plates49
CollinsCollins English Dictionary48
WNWWebster's New World College Dictionary44
Werner-scanWerner — digitized plates41
CambridgeCambridge Dictionary35
FaberFaber-Castell colour chart29
CrayolaCrayola colour list24
StabiloSTABILO CarbOthello colour chart23
Nearest-color matching uses CIELAB by default. CIELAB distance generally corresponds more closely to perceived color difference than component-wise RGB distance.
More than one name may have the same RGB value (grey and gray). Such names have equal color distance and may appear adjacent in nearest-color results.
CMYK results are computed conversions. They are not authoritative printing specifications and may vary from conversions made using a particular printer or ICC profile.
For some specific hex colors, the ISCC lists a hundred or more color names. To the extent possible, these clashes have been resolved to distinct colors or demoted to alternate names.

Examples

Basic Examples (3) 

Show lilac:

In[1]:=
ResourceFunction["Swatch"]["lilac"]
Out[1]=

Show several colors:

In[2]:=
ResourceFunction[
 "Swatch"][{"bluebonnet", "smalt", "erin", "lapis lazuli"}]
Out[2]=

Show the seven colors closest to parchment:

In[3]:=
ResourceFunction["Swatch"]["parchment", 7]
Out[3]=

Scope (4) 

Show the seven colors closest to a hex value:

In[4]:=
ResourceFunction["Swatch"]["#fade27", 7]
Out[4]=

Show the five colors closest to a decimal RGB value:

In[5]:=
ResourceFunction["Swatch"][{.6, .5, .1}, 5]
Out[5]=

List the citations for orange:

In[6]:=
ResourceFunction["Swatch"]["Orange", "Source"]
Out[6]=

For colors with four or more citations, list those with four-letter names:

In[7]:=
colors4 = Sort[Normal@
   ResourceFunction["Swatch"]["Dataset", 4][
    Select[StringLength[#Name] == 4 &], "Name"]]
Out[7]=

Show the colors:

In[8]:=
display4 = Transpose[{colors4, ResourceFunction["Swatch"][colors4]}]
Out[8]=

Make a graphic out of it:

In[9]:=
Grid[Partition[
  Text@Column[{#[[1]], Graphics[{#[[2]], Rectangle[]}, ImageSize -> 60]}] & /@ display4, UpTo[8]]]
Out[9]=

Options (6) 

Show the dataset of three-letter color names with three or more sources:

In[10]:=
colors3 = ResourceFunction["Swatch"]["Dataset", 3][
  Select[StringLength[#Name] == 3 &]]
Out[10]=

Get the six names:

In[11]:=
colorsthree = Normal[First /@ colors3]
Out[11]=

Get their colors:

In[12]:=
ResourceFunction["Swatch"][#] & /@ colorsthree
Out[12]=

Get their hexadecimal values:

In[13]:=
ResourceFunction["Swatch"][#, "Hex"] & /@ colorsthree
Out[13]=

Get their color citations:

In[14]:=
ResourceFunction["Swatch"][#, "ValueSource"] & /@ colorsthree
Out[14]=

Find the seven closest colors to each:

In[15]:=
Column[ResourceFunction["Swatch"][#, 7] & /@ colorsthree]
Out[15]=

Applications (2) 

Find a color name:

In[16]:=
ResourceFunction["Swatch"][{.2, .5, .7}, 6]
Out[16]=

Find similar colors:

In[17]:=
ResourceFunction["Swatch"]["lilac", 20]
Out[17]=

Properties and Relations (1) 

Spaces and capitalization are disregarded:

In[18]:=
ResourceFunction["Swatch"]["forest green"] === ResourceFunction["Swatch"]["ForestGreen"]
Out[18]=

Possible Issues (2) 

Several color names can have the same hex value:

In[19]:=
wodeisme = ResourceFunction["Swatch"]["wode", 7]
Out[19]=
In[20]:=
Union[InputForm[Last[#]] & /@ wodeisme]
Out[20]=

Various obscure colors can coincide with other colors:

In[21]:=
ResourceFunction["Swatch"]["bole armoniack"] == ResourceFunction["Swatch"]["colcothar"]
Out[21]=

Such duplicate colors are not found in the nearest searches:

In[22]:=
ResourceFunction["Swatch"]["bole armoniack", 12]
Out[22]=

Neat Examples (2) 

Make a Tooltip look-up list for 512 colors:

In[23]:=
data = Tooltip[
     Graphics[{#[[2]], Rectangle[]}, ImageSize -> 10], #[[1]]] & /@ Flatten[(ResourceFunction["Swatch"][#, 1] & /@ N[Tuples[Range[0, 7], 3]/8])];
Grid[Partition[data, 32], Spacings -> {0, 0}]
Out[24]=

Make a 3D color map of named colors:

In[25]:=
Graphics3D[
 KeyValueMap[{#2, Tooltip[Point[List @@ #2], #1]} &, ResourceFunction["Swatch"][All]], Axes -> True]
Out[25]=

Version History

  • 1.0.0 – 23 July 2026

Related Resources

License Information