Added assert and Scheduler, and started adding proper test frameworks
[tcl-tlc.git] / scripts / daftheme.itcl
blob686ca4002ed4a0e44216958bc9b76ba06fc9ae30
1 # vim: ft=tcl foldmethod=marker foldmarker=<<<,>>> ts=4 shiftwidth=4
3 class tlc::Daftheme {
4 inherit tlc::Theme
6 public {
7 method setting {tag}
10 private {
11 method buttonhibg {}
12 method entrybgcolor {}
13 method getfg {}
18 body tlc::Daftheme::setting {tag} { #<<<1
19 if {$::tcl_platform(platform) == "windows"} {
20 switch -- $tag {
21 hidebg {return systemButtonFace}
23 default {return [tlc::Theme::setting $tag]}
25 } else {
26 switch -- $tag {
27 textbackground {return [entrybgcolor]}
28 disabledbackground {return [adjusthexcolor [. cget -bg] 1.25]}
29 disabledforeground {return [adjusthexcolor [getfg] 0.8]}
30 enabledforeground {return [getfg]}
31 selectbackground {return [adjusthexcolor [. cget -bg] 0.7 0.7 0.8]}
32 selectforeground {return [adjusthexcolor [getfg] 0.9]}
33 background {return [. cget -bg]}
34 hidebg {return [. cget -bg]}
36 default {return [tlc::Theme::setting $tag]}
42 body tlc::Daftheme::buttonhibg {} { #<<<1
43 set rbg [winfo rgb . [. cget -bg]]
44 set maxrgb [winfo rgb . "#ffffff"]
45 set maxval [lindex $maxrgb 0]
46 return [format "#%02x%02x%02x" \
47 [min [expr {round([lindex $rbg 0] * 255/$maxval)}] 255] \
48 [min [expr {round([lindex $rbg 1] * 255/$maxval)}] 255] \
49 [min [expr {round([lindex $rbg 2] * 255/$maxval)}] 255]]
53 body tlc::Daftheme::entrybgcolor {} { #<<<1
54 set rbg [winfo rgb . [. cget -bg]]
55 set maxrgb [winfo rgb . "#ffffff"]
56 set maxval [lindex $maxrgb 0]
57 return [format "#%02x%02x%02x" \
58 [min [expr {round([lindex $rbg 0] * 1.25 * 255/$maxval)}] 255] \
59 [min [expr {round([lindex $rbg 1] * 1.25 * 255/$maxval)}] 255] \
60 [min [expr {round([lindex $rbg 2] * 1.25 * 255/$maxval)}] 255]]
64 body tlc::Daftheme::getfg {} { #<<<1
65 button .bgetfgcolor
66 set ret [.bgetfgcolor cget -fg]
67 destroy .bgetfgcolor
68 return $ret