|
| 1 | +registerDarkTheme "dark" |
| 2 | + |
| 3 | +# |
| 4 | +# Copyright (C) 2020 Uwe Klimmek |
| 5 | +# |
| 6 | +# This file is part of Scid (Shane's Chess Information Database). |
| 7 | +# Scid is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation. |
| 10 | + |
| 11 | +### Implements a "dark" theme. |
| 12 | + |
| 13 | +namespace eval ttk::theme::dark { |
| 14 | + array set colors { |
| 15 | + background "#323232" |
| 16 | + foreground "#e0e0e0" |
| 17 | + disabledfg "#a0a0a0" |
| 18 | + buttonbg "#3b3b3e" |
| 19 | + buttonbgdark "#2b2b2e" |
| 20 | + buttonbglight "#4b4b4e" |
| 21 | + labelframe "#a5a6a9" |
| 22 | + fieldbg "#1e1e1e" |
| 23 | + fieldborder "#292929" |
| 24 | + darkcolor "#222222" |
| 25 | + lightcolor "#656669" |
| 26 | + notebookborder "#555659" |
| 27 | + selectbg "#555659" |
| 28 | + selectfg "#ffffff" |
| 29 | + through "#353639" |
| 30 | + } |
| 31 | + |
| 32 | + ttk::style theme create dark -parent clam -settings { |
| 33 | + set basecol DodgerBlue3 ;# Alternative: #3b6dce Basecolor, change here to have new topic for the theme |
| 34 | + # ----------------------------------------------------------------------------- |
| 35 | + # Theme defaults |
| 36 | + ttk::style configure "." \ |
| 37 | + -foreground $colors(foreground) \ |
| 38 | + -background $colors(background) \ |
| 39 | + -darkcolor $colors(darkcolor) \ |
| 40 | + -lightcolor $colors(lightcolor) \ |
| 41 | + -troughcolor $colors(through) \ |
| 42 | + -selectbackground $basecol \ |
| 43 | + -selectforeground $colors(selectfg) \ |
| 44 | + -activebackground $basecol \ |
| 45 | + -activeforeground $colors(selectfg) \ |
| 46 | + -indicatorbackground $colors(fieldbg) \ |
| 47 | + -indicatorforeground $colors(foreground) \ |
| 48 | + -fieldbackground $colors(fieldbg) \ |
| 49 | + -bordercolor $colors(fieldborder) \ |
| 50 | + -selectborderwidth 0 \ |
| 51 | + -arrowcolor $colors(foreground) \ |
| 52 | + -insertcolor $colors(foreground) \ |
| 53 | + -insertbackground $colors(foreground) \ |
| 54 | + ; |
| 55 | + |
| 56 | + ttk::style map "." \ |
| 57 | + -foreground [list \ |
| 58 | + disabled $colors(disabledfg)] \ |
| 59 | + -background [list \ |
| 60 | + active $basecol] \ |
| 61 | + -fieldbackground [list \ |
| 62 | + disabled $colors(background)] \ |
| 63 | + -indicatorbackground [list \ |
| 64 | + pressed $colors(background) \ |
| 65 | + alternate $colors(disabledfg) \ |
| 66 | + disabled $colors(background)] \ |
| 67 | + -indicatorforeground [list \ |
| 68 | + disabled $colors(disabledfg)] \ |
| 69 | + -arrowcolor [list \ |
| 70 | + disabled $colors(disabledfg)] \ |
| 71 | + ; |
| 72 | + |
| 73 | + set borders [list disabled $colors(fieldborder) {active pressed} $basecol \ |
| 74 | + {disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \ |
| 75 | + {active selected} $basecol active $basecol selected $basecol focus $basecol ] |
| 76 | + set buttonborder [list disabled $colors(fieldborder) {active pressed} $basecol \ |
| 77 | + {disabled selected} $colors(fieldborder) {pressed selected} $basecol pressed $basecol \ |
| 78 | + {active selected} $basecol active $basecol selected $basecol ] |
| 79 | + set buttonsbg [list disabled $colors(through) pressed $colors(buttonbgdark) \ |
| 80 | + active $colors(buttonbglight) ] |
| 81 | + |
| 82 | + ttk::style configure TButton \ |
| 83 | + -anchor center \ |
| 84 | + -relief raised \ |
| 85 | + -padding 4 \ |
| 86 | + -background $colors(buttonbg) \ |
| 87 | + ; |
| 88 | + ttk::style map TButton \ |
| 89 | + -bordercolor $buttonborder \ |
| 90 | + -background $buttonsbg \ |
| 91 | + ; |
| 92 | + |
| 93 | + ttk::style configure TMenubutton \ |
| 94 | + -anchor center \ |
| 95 | + -padding 4 \ |
| 96 | + -relief raised \ |
| 97 | + -background $colors(buttonbg) \ |
| 98 | + ; |
| 99 | + ttk::style map TMenubutton \ |
| 100 | + -bordercolor $borders \ |
| 101 | + -background $buttonsbg \ |
| 102 | + ; |
| 103 | + |
| 104 | + ttk::style configure Toolbutton \ |
| 105 | + -anchor center \ |
| 106 | + -padding 2 \ |
| 107 | + -relief flat \ |
| 108 | + ; |
| 109 | + ttk::style map Toolbutton \ |
| 110 | + -relief [list \ |
| 111 | + {active !selected} raised] \ |
| 112 | + -bordercolor $borders \ |
| 113 | + -foreground [list \ |
| 114 | + disabled $colors(disabledfg)] \ |
| 115 | + -background [list \ |
| 116 | + pressed $basecol \ |
| 117 | + selected $basecol \ |
| 118 | + active $colors(darkcolor)] \ |
| 119 | + -lightcolor [list pressed $basecol] \ |
| 120 | + -darkcolor [list pressed $basecol] \ |
| 121 | + ; |
| 122 | + |
| 123 | + ttk::style configure TCheckbutton \ |
| 124 | + -padding 2 |
| 125 | + ; |
| 126 | + ttk::style configure TRadiobutton \ |
| 127 | + -padding 2 |
| 128 | + ; |
| 129 | + |
| 130 | + ttk::style configure TCombobox \ |
| 131 | + -anchor center \ |
| 132 | + -padding 1 \ |
| 133 | + -insertwidth 1 \ |
| 134 | + -relief raised \ |
| 135 | + -borderwidth 1 \ |
| 136 | + ; |
| 137 | + ttk::style map TCombobox \ |
| 138 | + -bordercolor $borders \ |
| 139 | + -background $buttonsbg \ |
| 140 | + -lightcolor $borders \ |
| 141 | + ; |
| 142 | + |
| 143 | + ttk::style configure TEntry \ |
| 144 | + -foreground $colors(selectfg) \ |
| 145 | + -padding 1 \ |
| 146 | + -insertwidth 1 \ |
| 147 | + ; |
| 148 | + ttk::style map TEntry \ |
| 149 | + -bordercolor $borders \ |
| 150 | + -lightcolor $borders \ |
| 151 | + ; |
| 152 | + |
| 153 | + ttk::style configure TSpinbox \ |
| 154 | + -arrowsize 12 \ |
| 155 | + -padding {2 0 10 0} \ |
| 156 | + ; |
| 157 | + ttk::style map TSpinbox \ |
| 158 | + -bordercolor $borders \ |
| 159 | + -background $buttonsbg \ |
| 160 | + -arrowcolor [list \ |
| 161 | + disabled $colors(disabledfg)] \ |
| 162 | + ; |
| 163 | + |
| 164 | + ttk::style configure TScale \ |
| 165 | + -troughcolor $colors(through) \ |
| 166 | + ; |
| 167 | + ttk::style map TScale \ |
| 168 | + -bordercolor [list \ |
| 169 | + active $basecol] \ |
| 170 | + ; |
| 171 | + |
| 172 | + ttk::style configure TNotebook.Tab \ |
| 173 | + -padding {6 2 6 2} \ |
| 174 | + ; |
| 175 | + ttk::style map TNotebook.Tab \ |
| 176 | + -padding [list \ |
| 177 | + selected {6 4 6 2}] \ |
| 178 | + -background [list \ |
| 179 | + selected $colors(background) \ |
| 180 | + {} $colors(fieldbg)] \ |
| 181 | + -lightcolor [list \ |
| 182 | + selected $colors(lightcolor) \ |
| 183 | + {} $colors(notebookborder)] \ |
| 184 | + ; |
| 185 | + |
| 186 | + ttk::style configure TPanedwindow \ |
| 187 | + -sashrelief raised \ |
| 188 | + ; |
| 189 | + |
| 190 | + ttk::style configure TLabelframe \ |
| 191 | + -bordercolor $colors(labelframe) \ |
| 192 | + -relief raised \ |
| 193 | + -padding 4 \ |
| 194 | + ; |
| 195 | + |
| 196 | + ttk::style configure TProgressbar \ |
| 197 | + -background $basecol \ |
| 198 | + ; |
| 199 | + |
| 200 | + ttk::style configure TScrollbar \ |
| 201 | + -arrowsize 10 -width 10 \ |
| 202 | + -troughcolor $colors(fieldbg) \ |
| 203 | + -bordercolor $colors(fieldbg) \ |
| 204 | + -background $colors(through) \ |
| 205 | + ; |
| 206 | + ttk::style map TScrollbar \ |
| 207 | + -background [list \ |
| 208 | + pressed $colors(lightcolor) \ |
| 209 | + active $colors(lightcolor) \ |
| 210 | + disabled $colors(through) \ |
| 211 | + !pressed $colors(buttonbglight)] \ |
| 212 | + -lightcolor [list \ |
| 213 | + pressed $colors(darkcolor) \ |
| 214 | + active $colors(lightcolor) \ |
| 215 | + disabled $colors(through) \ |
| 216 | + !pressed $colors(buttonbglight)] \ |
| 217 | + -darkcolor [list \ |
| 218 | + pressed $colors(lightcolor) \ |
| 219 | + active $colors(darkcolor) \ |
| 220 | + disabled $colors(through) \ |
| 221 | + !pressed $colors(buttonbglight)] \ |
| 222 | + ; |
| 223 | + # Remove arrows |
| 224 | + ttk::style layout Vertical.TScrollbar { |
| 225 | + Vertical.Scrollbar.trough -sticky news -children { |
| 226 | + Vertical.Scrollbar.thumb -expand true |
| 227 | + } |
| 228 | + } |
| 229 | + ttk::style layout Horizontal.TScrollbar { |
| 230 | + Horizontal.Scrollbar.trough -sticky news -children { |
| 231 | + Horizontal.Scrollbar.thumb -expand true |
| 232 | + } |
| 233 | + } |
| 234 | + |
| 235 | + ttk::style configure Heading \ |
| 236 | + -relief raised \ |
| 237 | + ; |
| 238 | + ttk::style map Heading \ |
| 239 | + -bordercolor $buttonborder \ |
| 240 | + -background $buttonsbg \ |
| 241 | + ; |
| 242 | + |
| 243 | + ttk::style configure Treeview \ |
| 244 | + -relief flat \ |
| 245 | + -bordercolor $colors(fieldbg) \ |
| 246 | + -lightcolor $colors(fieldbg) \ |
| 247 | + -background $colors(fieldbg) \ |
| 248 | + ; |
| 249 | + ttk::style map Treeview \ |
| 250 | + -background [list \ |
| 251 | + selected $basecol \ |
| 252 | + disabled $colors(darkcolor)] \ |
| 253 | + -foreground [list \ |
| 254 | + selected $colors(selectfg)] \ |
| 255 | + ; |
| 256 | + } |
| 257 | +} |
0 commit comments