色の名前で指定する。
pack [button .b -text Push -fg white -bg darkgreen] |
RGB値で指定する。(#Red値Green値Blue値の形式)
# 4 bits per color pack [button .b -text Push -fg #FFF -bg #000] # 8 bits per color pack [button .b -text Push -fg #FFFFFF -bg #000000] # 12 bits per color pack [button .b -text Push -fg #FFFFFFFFF -bg #000000000] # 16 bits per color pack [button .b -text Push -fg #FFFFFFFFFFFF -bg #000000000000] # PCのビジュアルクラスとピクセル当たりのビット数を求める winfo visualsavailable . =>{truecolor 16} # 色名→RGB値変換 proc rgb {color} { set v [winfo rgb . $color] return [format "#%04X%04X%04X" [lindex $v 0] [lindex $v 1] [lindex $v 2]] } rgb "CornflowerBlue" =>#68009800F000 |
WindowsとMacintoshでは、システムカラーを指定できます。
# Windows pack [button .b -text Push -fg systemWindowText -bg systemWindow] # Macintosh pack [button .b -text Push -fg systemButtonText -bg systemButtonFace] |