proc rgb color {
if {![string match #* $color]} then {
winfo rgb . $color
} else {
set color [string range $color 1 end]
switch -exact -- [string length $color] {
3 {
set r [string repeat [string index $color 0] 4]
set g [string repeat [string index $color 1] 4]
set b [string repeat [string index $color 2] 4]
}
6 {
set r [string repeat [string range $color 0 1] 2]
set g [string repeat [string range $color 2 3] 2]
set b [string repeat [string range $color 4 5] 2]
}
12 {
set r [string range $color 0 3]
set g [string range $color 4 7]
set b [string range $color 8 11]
}
}
list [scan $r %x] [scan $g %x] [scan $b %x]
}
}
© Wolf-Dieter Busch | Home | Sitemap | Urheber | A-Z