Where can I find the list of named colors that are accepted by the JavaScript API color object? It is NOT JavaScript's color list. For example
var myColor = new Color('orange'); returns white - because it doesn't know what orange is. (orange works just fine in any style item)
Thanks
Solved! Go to Solution.
The dojo definition for the dojo/_base/Color module that esri/Color is based on has a list here in the source code.
dojo/Color.js at master · dojo/dojo · GitHub
"black": [0,0,0],
"silver": [192,192,192],
"gray": [128,128,128],
"white": [255,255,255],
"maroon": [128,0,0],
"red": [255,0,0],
"purple": [128,0,128],
"fuchsia":[255,0,255],
"green": [0,128,0],
"lime": [0,255,0],
"olive": [128,128,0],
"yellow": [255,255,0],
"navy": [0,0,128],
"blue": [0,0,255],
"teal": [0,128,128],
"aqua": [0,255,255],
The dojo definition for the dojo/_base/Color module that esri/Color is based on has a list here in the source code.
dojo/Color.js at master · dojo/dojo · GitHub
"black": [0,0,0],
"silver": [192,192,192],
"gray": [128,128,128],
"white": [255,255,255],
"maroon": [128,0,0],
"red": [255,0,0],
"purple": [128,0,128],
"fuchsia":[255,0,255],
"green": [0,128,0],
"lime": [0,255,0],
"olive": [128,128,0],
"yellow": [255,255,0],
"navy": [0,0,128],
"blue": [0,0,255],
"teal": [0,128,128],
"aqua": [0,255,255],
If you'd like the full CSS3 color names, just require the "dojo/colors" modules and they'll be added to the Color.named list. Something kinda like this:
require(["dojo/_base/Color","dojo/colors"],function(Color,colors){ console.log(Color.named); var orangeClr = new Color(Color.named.orange); console.log(orangeClr); });