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

Markus Neteler neteler at osgeo.org
Tue Feb 14 09:14:57 PST 2017


On Thu, Oct 20, 2016 at 12:20 AM, Vaclav Petras <wenzeslaus at gmail.com> wrote:
> 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.

I just tested it with a soil map, great job!

> 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!).

Perhaps worthwhile to mention it in the manual?

thanks
Markus

> 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
>


More information about the grass-dev mailing list