Take a look a this discussion that goes into why you can't apply a color to the different fill patterns.
The hatch patterns cannot be altered via the api because they are images.
Only STYLE_SOLID will use the color provided. STYLE_SOLID and STYLE_NULL are the only "pure" esri/symbol/SimpleFillSymbol(s).
All the other fill options like STYLE_BACKWARD_DIAGONAL, are actually esri/symbol/PictureFillSymbol(s), which use images that are included in the api http://js.arcgis.com/3.7/js/esri/images/symbol/sfs/vertical.png.
The solution, work-around or what have you is to use esri/symbol/PictureFillSymbol with your own custom images.
David,
do you mean this? Esri picture marker symbol generator for JavaScript developers | ArcGIS Blog
Tim
Thanks Tim-
No, I mean the picture fill symbols - colored hatching, mangrove etc
I think you are stuck with what is available here SimpleFillSymbol | API Reference | ArcGIS API for JavaScript
Sorry, little more info - the sample:
Add graphics to a map | ArcGIS API for JavaScript
contains:
// fill symbol used for extent, polygon and freehand polygon, use a picture fill symbol
// the images folder contains additional fill images, other options: sand.png, swamp.png or stiple.png
var fillSymbol = new PictureFillSymbol( "images/mangrove.png", new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color('#000'), 1 ), 42, 42 );
and since url is part of the constructor, I was wondering if "images/mangrove.png", is local or is that being pulled in from the full api or maybe from the rest api?
David,
I see, that is a local png. What you would need is, get those png's and then host them locally.
Tim
Hmm, thanks that's what I thought too, but wasn't sure. Desktop accesses them from
C:\Program Files (x86)\ArcGIS\Desktop10.3\Styles\Pictures here as bmp's. Maybe a better question is:
How can I render the hatch or diagonal fill symbol lines when set as a simple fill symbol style? The fill symbol lines don't seem to be taking on the color set for the fill symbol, they remain black....
David
You mean the fills from the constant table here?
SimpleFillSymbol | API Reference | ArcGIS API for JavaScript
Yes, exactly
You can change the color of your mesh.
var sfs = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
new esri.Color([255,0,0]), 2),new esri.Color([255,255,0,0.25]));
look at this example: the first color changes the outline color and the second color changes your mesh color.