.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "palette 3" .TH palette 3 2023-07-25 "perl v5.38.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Tk::palette \- Modify the Tk color palette .SH SYNOPSIS .IX Header "SYNOPSIS" \&\fR\f(CI$widget\fR\fI\fR\->\fBsetPalette\fR(\fIbackground\fR) .PP \&\fR\f(CI$widget\fR\fI\fR\->\fBsetPalette(\fR\fIname\fR=>\fIvalue\fR?,\fIname\fR=>\fIvalue ...\fR?) .PP \&\fR\f(CI$widget\fR\fI\fR\->\fBbisque\fR .SH DESCRIPTION .IX Header "DESCRIPTION" The \fBsetPalette\fR method changes the color scheme for Tk. It does this by modifying the colors of existing widgets and by changing the option database so that future widgets will use the new color scheme. If \fBsetPalette\fR is invoked with a single argument, the argument is the name of a color to use as the normal background color; \fBsetPalette\fR will compute a complete color palette from this background color. Alternatively, the arguments to \fBsetPalette\fR may consist of any number of \fIname\fR\-\fIvalue\fR pairs, where the first argument of the pair is the name of an option in the Tk option database and the second argument is the new value to use for that option. The following database names are currently supported: .PP .Vb 4 \& activeBackground foreground selectColor \& activeForeground highlightBackground selectBackground \& background highlightColor selectForeground \& disabledForeground insertBackground troughColor .Ve .PP \&\fBsetPalette\fR tries to compute reasonable defaults for any options that you don't specify. You can specify options other than the above ones and Tk will change those options on widgets as well. This feature may be useful if you are using custom widgets with additional color options. .PP Once it has computed the new value to use for each of the color options, \&\fBsetPalette\fR scans the widget hierarchy to modify the options of all existing widgets. For each widget, it checks to see if any of the above options is defined for the widget. If so, and if the option's current value is the default, then the value is changed; if the option has a value other than the default, \fBsetPalette\fR will not change it. The default for an option is the one provided by the widget (\fB($w\->configure('option'))[3]\fR) unless \&\fBsetPalette\fR has been run previously, in which case it is the value specified in the previous invocation of \fBsetPalette\fR. .PP After modifying all the widgets in the application, \fBsetPalette\fR adds options to the option database to change the defaults for widgets created in the future. The new options are added at priority \fBwidgetDefault\fR, so they will be overridden by options from the .Xdefaults file or options specified on the command-line that creates a widget. .PP The method \fBbisque\fR is provided for backward compatibility: it restores the application's colors to the light brown (``bisque'') color scheme used in Tk 3.6 and earlier versions. .SH BUGS .IX Header "BUGS" The use of option database names rather than the configure names is understandable given the mechanism (copied from Tcl/Tk), but is potentially confusing. .PP The interpolation of different 'shades' of color used for 3D effects in 'RGB' space can lead to undesirable changes in 'hue'. Interpolation in 'HSV' (as used in \fBTk::ColorEditor\fR) would be more robust and X11R5's color support probably even more so. .SH "SEE ALSO" .IX Header "SEE ALSO" Tk::options .SH KEYWORDS .IX Header "KEYWORDS" bisque, color, palette