1palette(3)            User Contributed Perl Documentation           palette(3)
2
3
4

NAME

6       Tk::palette - Modify the Tk color palette
7

SYNOPSIS

9       $widget->setPalette(background)
10
11       $widget->setPalette(name=>value?,name=>value ...?)
12
13       $widget->bisque
14

DESCRIPTION

16       The setPalette method changes the color scheme for Tk.  It does this by
17       modifying the colors of existing widgets and by changing the option
18       database so that future widgets will use the new color scheme.  If
19       setPalette is invoked with a single argument, the argument is the name
20       of a color to use as the normal background color;  setPalette will
21       compute a complete color palette from this background color.
22       Alternatively, the arguments to setPalette may consist of any number of
23       name-value pairs, where the first argument of the pair is the name of
24       an option in the Tk option database and the second argument is the new
25       value to use for that option.  The following database names are
26       currently supported:
27
28        activeBackground       foreground      selectColor
29        activeForeground       highlightBackground     selectBackground
30        background     highlightColor  selectForeground
31        disabledForeground     insertBackground        troughColor
32
33       setPalette tries to compute reasonable defaults for any options that
34       you don't specify.  You can specify options other than the above ones
35       and Tk will change those options on widgets as well.  This feature may
36       be useful if you are using custom widgets with additional color
37       options.
38
39       Once it has computed the new value to use for each of the color
40       options, setPalette scans the widget hierarchy to modify the options of
41       all existing widgets.  For each widget, it checks to see if any of the
42       above options is defined for the widget.  If so, and if the option's
43       current value is the default, then the value is changed;  if the option
44       has a value other than the default, setPalette will not change it.  The
45       default for an option is the one provided by the widget
46       (($w->configure('option'))[3]) unless setPalette has been run
47       previously, in which case it is the value specified in the previous
48       invocation of setPalette.
49
50       After modifying all the widgets in the application, setPalette adds
51       options to the option database to change the defaults for widgets
52       created in the future.  The new options are added at priority
53       widgetDefault, so they will be overridden by options from the
54       .Xdefaults file or options specified on the command-line that creates a
55       widget.
56
57       The method bisque is provided for backward compatibility: it restores
58       the application's colors to the light brown (``bisque'') color scheme
59       used in Tk 3.6 and earlier versions.
60

BUGS

62       The use of option database names rather than the configure names is
63       understandable given the mechanism (copied from Tcl/Tk), but is
64       potentially confusing.
65
66       The interpolation of different 'shades' of color used for 3D effects in
67       'RGB' space can lead to undesirable changes in 'hue'.  Interpolation in
68       'HSV' (as used in Tk::ColorEditor) would be more robust and X11R5's
69       color support probably even more so.
70

SEE ALSO

72       Tk::options
73

KEYWORDS

75       bisque, color, palette
76
77
78
79perl v5.32.1                      2021-01-27                        palette(3)
Impressum