[GRASS5] hexadecimal color codes

Can anyone tell me if GRASS can deal with hexadecimal color codes (something like 0100FFAA)? I have a ascii vector file that contains hexadecimal color codes for the lines and polygons. I am writing a small program that converts that ascii vector file (which was output from another gis package) into the v.in.ascii format, and I wonder if I can retain that information.

Thanks,

Kirk

Kirk R. Wythers
Dept. of Forest Resources
University of Minnesota
email: kwythers@umn.edu
tel: 612.625.2261
fax: 612.625.5212

hi,
i´d like do run grass60 interactively and/or non-interactively in terminal command line mode…is that possible?
samuel

“Kirk R. Wythers” kwythers@umn.edu wrote:

Can anyone tell me if GRASS can deal with hexadecimal color codes
(something like 0100FFAA)? I have a ascii vector file that contains
hexadecimal color codes for the lines and polygons. I am writing a
small program that converts that ascii vector file (which was output
from another gis package) into the v.in.ascii format, and I wonder if I
can retain that information.

Thanks,

Kirk

Kirk R. Wythers
Dept. of Forest Resources
University of Minnesota
email: kwythers@umn.edu
tel: 612.625.2261
fax: 612.625.5212


Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/

Can anyone tell me if GRASS can deal with hexadecimal color codes
(something like 0100FFAA)? I have a ascii vector file that contains
hexadecimal color codes for the lines and polygons. I am writing a
small program that converts that ascii vector file (which was output
from another gis package) into the v.in.ascii format, and I wonder if
I can retain that information.

You probably want to transform it into a GRASS RBG column that
'd.vect -a' can use?

see
  http://grass.ibiblio.org/grass60/manuals/html60_user/d.vect.html

GRASS generally uses 0-255 instead of 00-FF for red:green:blue

0 00
1 01
2 02
3 03
4 04
5 05
6 06
7 07
8 08
9 09
10 0a
11 0b
12 0c
13 0d
14 0e
15 0f
16 10
17 11
...
254 fe
255 ff

so:

RRGGBB -> RRR:GGG:BBB

000000 is 0:0:0 is black

FFFFFF is 255:255:255 is white

FF0000 is 255:0:0 is red

etc. sometimes the hex version is shown with a "0x" in front of it, e.g.
0xFFFFFF.

maybe an awk expert can give a shell script version of this C code to do
the translation:

int r,g,b;
sscanf(color, "0x%02x%02x%02x", &r, &g, &b);
printf("%03d:%03d":%03d\n", r, g, b);

(something like 0100FFAA)?

if that is correct, the last pair ("AA") might be the alpha channel
(transparency) level? GRASS doesn't support that, but hopefully it
doesn't change in your data.

so that example would be 1:0:255 (after throwing away "AA")

n.b. It isn't advertised or recommended, but d.text.freetype will take
hex colors for its color options in addition to the usual 255:255:255
convention.

Hamish

i´d like do run grass60 interactively and/or non-interactively in
terminal command line mode..is that possible?

I'm not sure if you mean just without the GUI + start up screens:

$ grass60 -text /path/to/your/mapset

or actually starting GRASS and running grass commands automatically.

In the second case you can set $GISBASE and some of the other
environmental shell variables that init.sh usually does for you.
(Search the mailing list archives for more complete instructions..)

perhaps a cheap hack might be to put the commands in your
~/.grass.bashrc file?

Hamish