format #%02x%02x%02x [<some input command>] [same] [same]
What is the purpose of the above
It formats three numbers as 2 digit hexadecimal strings with leading 0s
used if the number only consists of a single digit in hex. The '#' is
just a literal character. Read the format man page for more information:
http://tmml.sourceforge.net/doc/tcl/format.html . For example, suppose
your input commands returned the numbers 255, 100, and 37, then you'd
get back a string "#ff6425", where FF in hex = 255 in decimal, 64 hex =
100 decimal, and 25 hex = 37 decimal.
At a guess, I'd say the code is producing RGB colour values for use in
HTML/CSS.
-- Neil
There is no dearth of expertise in this world !!
Someone is creating an #RRGGBB triplet most likely.
Jeff
> For example, suppose
> your input commands returned the numbers 255, 100, and 37, then you'd
> get back a string "#ff6425", where FF in hex = 255 in decimal, 64 hex
> 100 decimal, and 25 hex = 37 decimal.
You told that is will be #ff6425, but isnt it supposed to be ,
0xff6425 unless the first digit is a 0
That's a different specification. RGB colors in Tk, HTML and such use
the #RRGGBB format, which the discussed code delivers. Easily tested
in an interactive tclsh:
19% format #%02x%02x%02x 255 100 37
#ff6425
But if you want to mark it up with "0x" prefix, that's easy too:
20% format 0x%02x%02x%02x 255 100 37
0xff6425