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

NAME

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

BUGS

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

SEE ALSO

70       Tk::options
71

KEYWORDS

73       bisque, color, palette
74
75
76
77perl v5.8.8                       2008-02-05                        palette(3)
Impressum