|
| 1 | +# Copyright © 2021 rdbende <rdbende@gmail.com> |
| 2 | + |
| 3 | +source [file join [file dirname [info script]] theme light.tcl] |
| 4 | +source [file join [file dirname [info script]] theme dark.tcl] |
| 5 | + |
| 6 | +option add *tearOff 0 |
| 7 | + |
| 8 | +proc set_theme {mode} { |
| 9 | + if {$mode == "dark"} { |
| 10 | + ttk::style theme use "azure-dark" |
| 11 | + |
| 12 | + array set colors { |
| 13 | + -fg "#ffffff" |
| 14 | + -bg "#333333" |
| 15 | + -disabledfg "#ffffff" |
| 16 | + -disabledbg "#737373" |
| 17 | + -selectfg "#ffffff" |
| 18 | + -selectbg "#007fff" |
| 19 | + } |
| 20 | + |
| 21 | + ttk::style configure . \ |
| 22 | + -background $colors(-bg) \ |
| 23 | + -foreground $colors(-fg) \ |
| 24 | + -troughcolor $colors(-bg) \ |
| 25 | + -focuscolor $colors(-selectbg) \ |
| 26 | + -selectbackground $colors(-selectbg) \ |
| 27 | + -selectforeground $colors(-selectfg) \ |
| 28 | + -insertcolor $colors(-fg) \ |
| 29 | + -insertwidth 1 \ |
| 30 | + -fieldbackground $colors(-selectbg) \ |
| 31 | + -font {"Segoe Ui" 10} \ |
| 32 | + -borderwidth 1 \ |
| 33 | + -relief flat |
| 34 | + |
| 35 | + tk_setPalette background [ttk::style lookup . -background] \ |
| 36 | + foreground [ttk::style lookup . -foreground] \ |
| 37 | + highlightColor [ttk::style lookup . -focuscolor] \ |
| 38 | + selectBackground [ttk::style lookup . -selectbackground] \ |
| 39 | + selectForeground [ttk::style lookup . -selectforeground] \ |
| 40 | + activeBackground [ttk::style lookup . -selectbackground] \ |
| 41 | + activeForeground [ttk::style lookup . -selectforeground] |
| 42 | + |
| 43 | + ttk::style map . -foreground [list disabled $colors(-disabledfg)] |
| 44 | + |
| 45 | + option add *font [ttk::style lookup . -font] |
| 46 | + option add *Menu.selectcolor $colors(-fg) |
| 47 | + |
| 48 | + } elseif {$mode == "light"} { |
| 49 | + ttk::style theme use "azure-light" |
| 50 | + |
| 51 | + array set colors { |
| 52 | + -fg "#000000" |
| 53 | + -bg "#ffffff" |
| 54 | + -disabledfg "#737373" |
| 55 | + -disabledbg "#ffffff" |
| 56 | + -selectfg "#ffffff" |
| 57 | + -selectbg "#007fff" |
| 58 | + } |
| 59 | + |
| 60 | + ttk::style configure . \ |
| 61 | + -background $colors(-bg) \ |
| 62 | + -foreground $colors(-fg) \ |
| 63 | + -troughcolor $colors(-bg) \ |
| 64 | + -focuscolor $colors(-selectbg) \ |
| 65 | + -selectbackground $colors(-selectbg) \ |
| 66 | + -selectforeground $colors(-selectfg) \ |
| 67 | + -insertcolor $colors(-fg) \ |
| 68 | + -insertwidth 1 \ |
| 69 | + -fieldbackground $colors(-selectbg) \ |
| 70 | + -font {"Segoe Ui" 10} \ |
| 71 | + -borderwidth 1 \ |
| 72 | + -relief flat |
| 73 | + |
| 74 | + tk_setPalette background [ttk::style lookup . -background] \ |
| 75 | + foreground [ttk::style lookup . -foreground] \ |
| 76 | + highlightColor [ttk::style lookup . -focuscolor] \ |
| 77 | + selectBackground [ttk::style lookup . -selectbackground] \ |
| 78 | + selectForeground [ttk::style lookup . -selectforeground] \ |
| 79 | + activeBackground [ttk::style lookup . -selectbackground] \ |
| 80 | + activeForeground [ttk::style lookup . -selectforeground] |
| 81 | + |
| 82 | + ttk::style map . -foreground [list disabled $colors(-disabledfg)] |
| 83 | + |
| 84 | + option add *font [ttk::style lookup . -font] |
| 85 | + option add *Menu.selectcolor $colors(-fg) |
| 86 | + } |
| 87 | +} |
0 commit comments