Thursday, March 25, 2010

Colour formatting on the Tcl Side

The Tcl formt command can be used to easily convert decimal rgb colour coordinates into hexadecimal.

set color [format #%02x%02x%02x $r $g $b]

Ok, from the Gnocl view point the goal is also to allow decimal values to be passed as colours, but, of course its useful to have a Tcl way of solving the problem, especially when developing the bare bones of a new widget binding which hasn't yet had all the colour manipulation functions wired into place.




No comments: