hi list,
I'm trying to implement a color picker in one of my PD/GEM patches via TCL/tk (-lib Toxy). But as you can see in the example patch (attached) I need to convert the hex color values to RGB values. Now I was wondering if there is any object in some external which would do the job (conversion)?! Any hint would be more than welcome.
best regards gm
#N canvas 410 610 234 187 12; #X msg 21 43 query tk_chooseColor; #X obj 21 70 tot .; #X symbolatom 21 100 10 0 0 0 - - -; #X connect 0 0 1 0; #X connect 1 0 2 0;
Ungestört surfen. MSN Toolbar mit Pop-up-Blocker. http://toolbar.msn.de/ Jetzt kostenlos downloaden!
I read:
But as you can see in the example patch (attached) I need to convert the hex color values to RGB values. Now I was wondering if there is any object in some external which would do the job (conversion)?! Any hint would be more than welcome.
well tcl could do it, see -> http://wiki.tcl.tk/1067 , in python it' would be just int ('0xff', 16) so pyext might come in handy.
HTH
x
hi G_ M,
"winfo rgb ." is Tk's color name to rgb converter (for the root window's colormap). Since it fails if given an empty string, it should either be wrapped in a catch clause, or in a test, like this:
query set cl [tk_chooseColor] .: if .($cl != "".) .(winfo rgb . $cl.)
The tot's output is then a list of three 16-bit intensities, so they would probably need to be unpacked, and quantized with / 256 -> int.
Krzysztof
G_ M wrote: ...
But as you can see in the example patch (attached) I need to convert the hex color values to RGB values. Now I was wondering if there is any
...
#X msg 21 43 query tk_chooseColor;