On 3 April 2016 at 06:41, Anita Graser <[email protected]> wrote: > Hi, > > Is it possible to directly add new color ramps to QGIS using Python? > I know that it's possible to write style xml files for color ramps which can > then be imported but a more direct solution would be great.
Untested, but something like ramp = QgsVectorGradientColorRampV2( color1, color2 ) tags=[] QgsStyleV2.defaultStyle().saveColorRamp( 'my ramp', ramp, 0, tags ) should work. See https://qgis.org/api/classQgsVectorGradientColorRampV2.html and https://qgis.org/api/classQgsStyleV2.html#a14a66fbd382fa858cbc8cd73d394724d Nyall > > Thanks and best wishes, > Anita > > _______________________________________________ > Qgis-developer mailing list > [email protected] > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer _______________________________________________ Qgis-developer mailing list [email protected] List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
