Tk Source Code

Changes On Branch bug-98c41cf3e7
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-98c41cf3e7 Excluding Merge-Ins

This is equivalent to a diff from 837b4eba to 48cc00a1

2018-05-03
20:25
Fix [98c41cf3e7]: ::tk::Darken does not properly brighten colors check-in: 228b1c83 user: fvogel tags: core-8-6-branch
2018-04-30
15:53
Fix [6d5042069f]: tk inactive does not work on macOS (tk-6.5 fails) check-in: adb7926c user: culler tags: core-8-6-branch
2018-04-29
01:51
Create a simple inactivity timer. check-in: 9e956dfe user: culler tags: bug-6d5042069f
2018-04-28
07:38
Fix [98c41cf3e7]: ::tk::Darken does not properly brighten colors Closed-Leaf check-in: 48cc00a1 user: fvogel tags: bug-98c41cf3e7
07:21
Fix [7423f90fbf]: missing option priorities prevent users from styling some widgets check-in: a81d9581 user: fvogel tags: trunk
07:20
Fix [7423f90fbf]: missing option priorities prevent users from styling some widgets check-in: 837b4eba user: fvogel tags: core-8-6-branch
2018-04-24
00:00
Set the other 'option add' commands to use widgetDefault as the priority. Closed-Leaf check-in: c9b03e6d user: bll tags: bug-7423f90f
2018-04-12
22:46
Fix two new gcc-7.3 (harmless) compiler warnings. check-in: 73184e82 user: jan.nijtmans tags: core-8-6-branch

Changes to library/palette.tcl.

201
202
203
204
205
206
207
208
209
210
211
212





213
214
215
216
217
218
219

220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235

# ::tk::Darken --
# Given a color name, computes a new color value that darkens (or
# brightens) the given color by a given percent.
#
# Arguments:
# color -	Name of starting color.
# perecent -	Integer telling how much to brighten or darken as a
#		percent: 50 means darken by 50%, 110 means brighten
#		by 10%.

proc ::tk::Darken {color percent} {





    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
    }
    if {$green > 255} {
	set green 255
    }
    if {$blue > 255} {
	set blue 255
    }
    return [format "#%02x%02x%02x" $red $green $blue]
}

# ::tk_bisque --
# Reset the Tk color palette to the old "bisque" colors.
#
# Arguments:
# None.







|




>
>
>
>
>
|
|
|
|
<
<
|
>
|
<
<
|
<
<
|

|







201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221


222
223
224


225


226
227
228
229
230
231
232
233
234
235

# ::tk::Darken --
# Given a color name, computes a new color value that darkens (or
# brightens) the given color by a given percent.
#
# Arguments:
# color -	Name of starting color.
# percent -	Integer telling how much to brighten or darken as a
#		percent: 50 means darken by 50%, 110 means brighten
#		by 10%.

proc ::tk::Darken {color percent} {
    if {$percent < 0} {
        return #000000
    } elseif {$percent > 200} {
        return #ffffff
    } elseif {$percent <= 100} {
        lassign [winfo rgb . $color] r g b
        set r [expr {($r/256)*$percent/100}]
        set g [expr {($g/256)*$percent/100}]
        set b [expr {($b/256)*$percent/100}]


    } elseif {$percent > 100} {
        lassign [winfo rgb . $color] r g b
        set r [expr {255 - ((65535-$r)/256)*(200-$percent)/100}]


        set g [expr {255 - ((65535-$g)/256)*(200-$percent)/100}]


        set b [expr {255 - ((65535-$b)/256)*(200-$percent)/100}]
    }
    return [format #%02x%02x%02x $r $g $b]
}

# ::tk_bisque --
# Reset the Tk color palette to the old "bisque" colors.
#
# Arguments:
# None.