Hello out there,
is there a function to turn Tk colors' names (like red or chocolate)
into their rgb equivalents?
Thanks for any hints
Helmut
Hello out there,winfo rgb window color
is there a function to turn Tk colors' names (like red or chocolate)
into their rgb equivalents?
Thanks for any hints
Helmut
This is what I use:
lassign [winfo rgb . $c] r g b
set r [expr {$r % 256}]
set g [expr {$g % 256}]
set b [expr {$b % 256}]
format "\#%02x%02x%02x" $r $g $b
Interesting choice to use the least significant byte of the color
values. It happens to work as long as both bytes are the same, which
they seem to be for now. But I would have picked the most significant
byte myself, just in case there may be graphics cards in the future with more than 8 bits per color.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,070 |
Nodes: | 10 (1 / 9) |
Uptime: | 18:18:00 |
Calls: | 13,740 |
Calls today: | 2 |
Files: | 186,972 |
D/L today: |
2,441 files (758M bytes) |
Messages: | 2,420,089 |