[GRASS-dev] Re: [GRASS-user] [off-topic] spoke too soon

Benjamin Ducke benjamin.ducke at ufg.uni-kiel.de
Wed Oct 3 15:13:10 EDT 2007

[taking this over to the devel list]

Parsing GRASS colour rules is very simple. It's all in the
GRASS Programmer's Manual.

Full docs for CPT format are here:


(section 4.15 of the GMT docs)

Apparently, GMT supports HSV schemes, as well.


1. Does GRASS also support colour models other than RGB?
2. Is '%" treated like a comment in the GRASS 'colr' files?
3. Is '#' as a comment indicator also OK in 'colr' files?
4. GMT also has labels for colour ranges. Would it be a good
idea to transfer those to the raster file (given that there
is no category labelling already or the user chooses to
overwrite it)?


Dylan Beaudette wrote:
> On Wednesday 03 October 2007, Benjamin Ducke wrote:
>> Good stuff
>> All the palettes are available in GMT color format, which is just plain
>> ASCII and very similar to GRASS' own colour rule files in the 'cols'
>> database elements. The only major difference seems to be three
>> additional lines at the end of the file specifying colours for
>> foreground, background and no data areas which could simply be
>> discarded.
> Indeed. Will have to poke around in the r.colors source -- anyone an expert on 
> how the rules file is parsed?
>> So how about adding an option cpt=filename to r.colors, to set the
>> color rules for a raster map from a GMT ASCII file?
> I think that this would be a great addition. The GMT folks might like it as 
> well.
>> The best of these styles could still be hardcoded into r.colors'
>> database.
> Agreed.
>> Benjamin
>> P.S.: Some of these palettes actually have licenses attached to them.
>> What sort of a world do we live in that requires the most trivial
>> things to be licensed? Come on people, you can give _some_ things to
>> the public domain w/o conditions ...
> My thoughts exactly- however you are going to have to pay-up if you decide to 
> implement this idea!  j/k 
> Dylan
>> Dylan Beaudette wrote:
>>> Sorry about those last two messages. My fingers where too fast for my
>>> brain, and inadvertently caused the keys ctrl-enter to be pressed (curse
>>> you Kmail!).
>>> What I had tried to mention was the collection of color palette files
>>> here:
>>> http://sview01.wiredworkplace.net/pub/cpt-city/
>>> Perhaps we can convert a pile of these into GRASS-compatible color rules
>>> files.
>>> Cheers,
>>> Dylan

Benjamin Ducke, M.A.
(Archaeoinformation Science)
Institut für Ur- und Frühgeschichte
(Inst. of Prehistoric and Historic Archaeology)
Christian-Albrechts-Universität zu Kiel
Johanna-Mestorf-Straße 2-6
D 24098 Kiel

Tel.: ++49 (0)431 880-3378 / -3379
Fax : ++49 (0)431 880-7300

More information about the grass-dev mailing list