diff options
author | stanton <stanton> | 1999-04-16 01:51:06 (GMT) |
---|---|---|
committer | stanton <stanton> | 1999-04-16 01:51:06 (GMT) |
commit | 03656f44f81469f459031fa3a4a7b09c8bc77712 (patch) | |
tree | 31378e81bd58f8c726fc552d6b30cbf3ca07497b /library/palette.tcl | |
parent | 404fc236f34304df53b7e44bc7971d786b87d453 (diff) | |
download | tk-03656f44f81469f459031fa3a4a7b09c8bc77712.zip tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.gz tk-03656f44f81469f459031fa3a4a7b09c8bc77712.tar.bz2 |
* Merged 8.1 branch into the main trunk
Diffstat (limited to 'library/palette.tcl')
-rw-r--r-- | library/palette.tcl | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/library/palette.tcl b/library/palette.tcl index 572e1e3..45000b0 100644 --- a/library/palette.tcl +++ b/library/palette.tcl @@ -3,7 +3,7 @@ # This file contains procedures that change the color palette used # by Tk. # -# RCS: @(#) $Id: palette.tcl,v 1.3 1998/09/14 18:23:24 stanton Exp $ +# RCS: @(#) $Id: palette.tcl,v 1.4 1999/04/16 01:51:26 stanton Exp $ # # Copyright (c) 1995-1997 Sun Microsystems, Inc. # @@ -187,23 +187,22 @@ proc tkRecolorTree {w colors} { # by 10%. proc tkDarken {color percent} { - set l [winfo rgb . $color] - set red [expr {[lindex $l 0]/256}] - set green [expr {[lindex $l 1]/256}] - set blue [expr {[lindex $l 2]/256}] - set red [expr {($red*$percent)/100}] + foreach {red green blue} [winfo rgb . $color] { + set red [expr {($red/256)*$percent/100}] + set green [expr {($green/256)*$percent/100}] + set blue [expr {($blue/256)*$percent/100}] + break + } if {$red > 255} { set red 255 } - set green [expr {($green*$percent)/100}] if {$green > 255} { set green 255 } - set blue [expr {($blue*$percent)/100}] if {$blue > 255} { set blue 255 } - format #%02x%02x%02x $red $green $blue + return [format "#%02x%02x%02x" $red $green $blue] } # tk_bisque -- |