[GRASS-dev] Programmatically obtain GRASS colour ramps in Python

Stefan Blumentrath Stefan.Blumentrath at nina.no
Mon Sep 17 12:28:04 PDT 2018


r.colors manual says color ramps are saved in:
$GISBASE/etc/colors/<name>, so values could be read from there, I guess.

And the parser can give you GUI access to the rules names with the
G_OPT_M_COLR option:
https://grass.osgeo.org/grass77/manuals/parser_standard_options.html

Cheers
Stefan


-----Original Message-----
From: grass-dev <grass-dev-bounces at lists.osgeo.org> On Behalf Of Markus Neteler
Sent: mandag 17. september 2018 20:15
To: Pierre Roudier <pierre.roudier at gmail.com>
Cc: GRASS developers list <grass-dev at lists.osgeo.org>
Subject: Re: [GRASS-dev] Programmatically obtain GRASS colour ramps in Python

On Mon, Sep 17, 2018 at 4:17 AM Pierre Roudier <pierre.roudier at gmail.com> wrote:
>
> Hi all,
>
> I am trying to write a little Python extension wrapping r.color to use 
> different kind of strecthes,
>
> It should be pretty simple, basically just builkding rules on-the-fly 
> and pass them to r.color. But I can't quite seem how to retrieve the 
> GRASS color ramps details to create my ruleset.
>
> Is there any portable way to actually to actually passthe name of a 
> GRASS color ramp, and get the details (colours) of that colour ramp?

Maybe you can find some code here:

gui/wxpython/modules/colorrules.py

best
Markus
_______________________________________________
grass-dev mailing list
grass-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev


More information about the grass-dev mailing list