[GRASS-dev] Color tables/rules now use standardized color parsing

Vaclav Petras wenzeslaus at gmail.com
Wed Oct 19 15:20:17 PDT 2016


Dear all,

in r69708, I've changed the implementation of parsing color rules to use
the G_str_to_color() function instead of a custom mechanism. This, in
connection with r69683, adds the possibility to use HTML (CSS) style of
hexadecimal colors with leading hash.

So, now you can do:

r.colors elevation rules=- <<EOF
0% #D24926
100% #FCE36D
EOF

Where it gets little tricky is that hash is used to comment a line in color
rules/color table format. A comment is now implemented as a line where
first character is hash, so there is no interference. We just need to keep
it that way.

The comments (# ...) are actually not documented in r.colors manual. Same
goes also for the syntax with space as a separator instead of colon. Now we
also support ; and , as separators (because that's what G_str_to_color()
supports). The hash syntax keeps tradition and it is undocumented as well
for now (but there is a test!).

Best,
Vaclav


r69708 https://trac.osgeo.org/grass/changeset/69708
r69683 https://trac.osgeo.org/grass/changeset/69683
Specify color as #RRGGBB
https://lists.osgeo.org/pipermail/grass-dev/2016-October/082662.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20161019/6523cdf6/attachment.html>


More information about the grass-dev mailing list