1tk_setPalette(n) Tk Built-In Commands tk_setPalette(n)
2
3
4
5______________________________________________________________________________
6
8 tk_setPalette, tk_bisque - Modify the Tk color palette
9
11 tk_setPalette background
12
13 tk_setPalette name value ?name value ...?
14
15 tk_bisque
16______________________________________________________________________________
17
19 The tk_setPalette procedure changes the color scheme for Tk. It does
20 this by modifying the colors of existing widgets and by changing the
21 option database so that future widgets will use the new color scheme.
22 If tk_setPalette is invoked with a single argument, the argument is the
23 name of a color to use as the normal background color; tk_setPalette
24 will compute a complete color palette from this background color.
25 Alternatively, the arguments to tk_setPalette may consist of any number
26 of name-value pairs, where the first argument of the pair is the name
27 of an option in the Tk option database and the second argument is the
28 new value to use for that option. The following database names are
29 currently supported:
30
31 activeBackground foregroundselectColor
32 activeForeground highlightBackgroundselectBackground
33 background highlightColor selectForeground
34 disabledForeground insertBackgroundtroughColor
35
36 tk_setPalette tries to compute reasonable defaults for any options that
37 you do not specify. You can specify options other than the above ones
38 and Tk will change those options on widgets as well. This feature may
39 be useful if you are using custom widgets with additional color
40 options.
41
42 Once it has computed the new value to use for each of the color
43 options, tk_setPalette scans the widget hierarchy to modify the options
44 of all existing widgets. For each widget, it checks to see if any of
45 the above options is defined for the widget. If so, and if the
46 option's current value is the default, then the value is changed; if
47 the option has a value other than the default, tk_setPalette will not
48 change it. The default for an option is the one provided by the widget
49 ([lindex [$w configure $option] 3]) unless tk_setPalette has been run
50 previously, in which case it is the value specified in the previous
51 invocation of tk_setPalette.
52
53 After modifying all the widgets in the application, tk_setPalette adds
54 options to the option database to change the defaults for widgets cre‐
55 ated in the future. The new options are added at priority widgetDe‐
56 fault, so they will be overridden by options from the .Xdefaults file
57 or options specified on the command-line that creates a widget.
58
59 The procedure tk_bisque is provided for backward compatibility: it
60 restores the application's colors to the light brown (“bisque”) color
61 scheme used in Tk 3.6 and earlier versions.
62
64 bisque, color, palette
65
66
67
68Tk 4.0 tk_setPalette(n)