2

I am aware of accessing color ramp using the ColorRamp method of the arcpy.mp module. However, this only gets existing color ramps.

Is there any way of creating new color ramp programmatically, for example, Yellow to Black?

Pfalbaum
9417 silver badges29 bronze badges
asked Feb 12, 2018 at 23:14
4
  • I don't think this is possible with arcpy...you'll most likely need to dive into ArcObjects. Refer to (help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/…) Commented Feb 12, 2018 at 23:25
  • Perhaps look into attribute driven symbology if you need a workaround. Commented Feb 12, 2018 at 23:42
  • Did you see the 2nd python example here: pro.arcgis.com/en/pro-app/arcpy/mapping/… The help explains: The fill color graduates from red to blue, and the outline color goes from blue to red and increases in size with each break.. So you can create your own, you just need to figure out the colors. Commented Feb 13, 2018 at 13:43
  • Alternatively, using .NET you can probably achieve this if you figure out the color values. Take a look at some of this code: github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/… Commented Feb 13, 2018 at 13:47

1 Answer 1

2

Better later than never. If your desired color scheme is not available, you can create one manually, save it, and then call it in your script. For example, here's what I did to get a Red to Yellow scheme (which didn't exist) in a graduated colors ramp using ArcGIS Pro 2.8.0:

1.) Symbology pane --> Color Scheme drop down --> Format color scheme...

enter image description here

2.) In the Color Sceme Editor, match the color stops with the amount of class breaks and give them the relevant color(s).

enter image description here

3.) Save to a style... --> Name it and hit OK. It will be saved with the other ramps.

enter image description here

enter image description here

Now you can call it in your script:

import arcpy
aprx = arcpy.mp.ArcGISProject('CURRENT')
colorramps = aprx.listColorRamps()
for color in colorramps:
 print(color.name)
Red To Yellow
Accent (3 Classes)
Accent (4 Classes)
Accent (5 Classes)
Accent (6 Classes)
Accent (7 Classes)
Accent (8 Classes)
Aspect
Basic Random
Bathymetric Scale
Bathymetry #1
Bathymetry #2
Bathymetry #3
Bathymetry #4
Bathymetry #5
Black and White
Black to White
Blue-Brown-Red 2x2
Blue-Brown-Red 3x3
...
answered Sep 17, 2021 at 21:09

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.