diff options
Diffstat (limited to 'library/palette.tcl')
-rw-r--r-- | library/palette.tcl | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/library/palette.tcl b/library/palette.tcl index 1838514..21be8dc 100644 --- a/library/palette.tcl +++ b/library/palette.tcl @@ -50,13 +50,11 @@ proc ::tk_setPalette {args} { set new(foreground) white } } - - # To avoir too many lindex... - foreach {fg_r fg_g fg_b} [winfo rgb . $new(foreground)] {break} - foreach {bg_r bg_g bg_b} $bg {break} - + lassign [winfo rgb . $new(foreground)] fg_r fg_g fg_b + lassign $bg bg_r bg_g bg_b set darkerBg [format #%02x%02x%02x [expr {(9*$bg_r)/2560}] \ [expr {(9*$bg_g)/2560}] [expr {(9*$bg_b)/2560}]] + foreach i {activeForeground insertBackground selectForeground \ highlightColor} { if {![info exists new($i)]} { @@ -78,7 +76,7 @@ proc ::tk_setPalette {args} { # up by 15% or 1/3 of the way to full white, whichever is # greater. - foreach i {0 1 2} color "$bg_r $bg_g $bg_b" { + foreach i {0 1 2} color $bg { set light($i) [expr {$color/256}] set inc1 [expr {($light($i)*15)/100}] set inc2 [expr {(255-$light($i))/3}] @@ -100,9 +98,6 @@ proc ::tk_setPalette {args} { if {![info exists new(troughColor)]} { set new(troughColor) $darkerBg } - if {![info exists new(selectColor)]} { - set new(selectColor) #b03060 - } # let's make one of each of the widgets so we know what the # defaults are currently for this platform. @@ -176,16 +171,16 @@ proc ::tk::RecolorTree {w colors} { # dbOption, then use it, otherwise use the defaults # for the widget. set defaultcolor [option get $w $dbOption $class] - if {[string match {} $defaultcolor] || \ + if {$defaultcolor eq "" || \ ([info exists prototype] && \ [$prototype cget $option] ne "$defaultcolor")} { set defaultcolor [lindex $value 3] } - if {![string match {} $defaultcolor]} { + if {$defaultcolor ne ""} { set defaultcolor [winfo rgb . $defaultcolor] } set chosencolor [lindex $value 4] - if {![string match {} $chosencolor]} { + if {$chosencolor ne ""} { set chosencolor [winfo rgb . $chosencolor] } if {[string match $defaultcolor $chosencolor]} { @@ -242,7 +237,7 @@ proc ::tk_bisque {} { tk_setPalette activeBackground #e6ceb1 activeForeground black \ background #ffe4c4 disabledForeground #b0b0b0 foreground black \ highlightBackground #ffe4c4 highlightColor black \ - insertBackground black selectColor #b03060 \ + insertBackground black \ selectBackground #e6ceb1 selectForeground black \ troughColor #cdb79e } |