3

Is there a way to save an edited, pre-existing color ramp as a new color ramp, or export the edited color ramp in QGIS 2.18.xx?

I'm able to take an existing gradient ramp, say, "Blues", and edit it, which is very handy. After editing the name of the ramp changes to "[source]":layer properites dialog1

...and the layer is styled with the edited ramp-- however, the actual edited ramp itself doesn't seem to persist when I save my project file, save the style, etc... the layer itself remains styled in that edited color ramp, however. If I want to edit the ramp further or transfer that ramp to a different layer, I have to start from scratch:

When I launch the layer properties dialog again, the ramp comes up blank, and I'm unable to edit it: layerProperties with absent ramp

Right now my workaround is to write down all of the information for the edited ramp (values, percentages, stops, etc...) and create a new ramp from that... but that's rather inefficient. Just want to make sure there isn't something obvious I'm missing before I submit a bug report / feature request.

1
  • Hi Joe - Looks like you can do it in QGIS 3 (2.99).
    – Baswein
    Commented Jan 30, 2018 at 23:29

3 Answers 3

1

Looks like you can do it in QGIS 3 (2.99). I'm not sure if that means you shouldn't submit a missing feature for 2.18. -Bas 2.99 Save color Ramp

4
  • Thanks Bas! I was hoping this would be a feature in 3. Haven't had a chance to install 2.99 yet though I probably should...
    – GeoJoeK
    Commented Jan 31, 2018 at 1:43
  • It is really easy to install the weekly. On windows anyway. I wonder if you can then save and export it out of 2.99 and import it into 2.18.
    – Baswein
    Commented Jan 31, 2018 at 21:27
  • I tried it. You can using the style manager.
    – Baswein
    Commented Jan 31, 2018 at 23:12
  • Thanks! I used to run the nightly builds on my Mac + Linux way back but have shifted to using the stable releases due to bugs. Will try getting the 2.99 nightly build up on one of them, which is complicated but not impossible.
    – GeoJoeK
    Commented Feb 1, 2018 at 0:58
1

I don't know a direct way, you need to do it manually once and import it to QGIS.

An example with a modified blues color ramp:

enter image description here

Create a .xml file with this configuration:

<!DOCTYPE qgis_style>
<qgis_style version="1">
  <symbols/>
  <colorramps>
    <colorramp type="gradient" name="Custom_blues">
      <prop k="color1" v="247,251,255,255"/>
      <prop k="color2" v="8,48,107,255"/>
      <prop k="continuos" v="0"/>
      <prop k="stops" v="0.115;198,219,239,255:0.326;222,235,247,255:0.651;66,146,198,255:0.902;8,81,156,255"/>
    </colorramp>
  </colorramps>
</qgis_style>

Where color1 and color2 are limit colors in form R,G,B,Alpha (0-255). And each stop is STOP(0-1 range);R,G,B,Alpha and : is used as separator between stops.

Import it back in QGIS (Settings / Style manager / Color ramp / Import):

enter image description here

And you'll be able to use this color ramp as a predefined color ramp in QGIS.

0
0

Instead of editing an existing color ramp, scroll down to the bottom of the color ramp list and select "new color ramp." After you create a new color ramp, you can give it a name and it will show up in the color ramp menu, even in new QGIS projects. enter image description here

1
  • Thanks-- but this doesn't solve my issue-- I don't want to create a new ramp from scratch (it's what I'm already doing), I want to save an edited, pre-existing ramp to a new ramp.
    – GeoJoeK
    Commented Jan 30, 2018 at 20:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.