This is a set of functions for manipulating colors and for modifying the color scheme of an application or a widget. Colors can be represented in a number of ways:
[1.0, 0.6, 0.0].
brightness As used in these functions, the brightness of a color is the brightness as registered by the human eye. For example, even though the colors red, blue and yellow have the same intensity (1.0), they have different brightnesses, 0.299, 0.114 and 0.886 respectively, reflecting the different way these colors appear to the eye. The brightness of a color is a value between 0.0 (dark) and 1.0 (bright).
color scheme A color scheme is a set of colors defined for each
of the default color options in the Tk option database. Color
schemes can be used in two ways. Firstly, using
Pmw.Color.setscheme(), the Tk option database can be set to the
values in the color scheme. This will not have any effect on
currently existing widgets, but any new widgets created after
setting the options will have these colors as their defaults.
Pmw.Color.changecolor() the color scheme can be
used to change the colors of a widget and all its child widgets.
A color scheme is specified by defining one or more color options
(one of the defined options must be
background). Not all
options need be specified - if any options are not defined, they
are calculated from the other colors. These are the options used
by a color scheme, together with their values if not specified:
background: (must be specified) foreground: black activeForeground: same as foreground insertBackground: same as foreground selectForeground: same as foreground highlightColor: same as foreground disabledForeground: between fg and bg but closer to bg highlightBackground: same as background activeBackground: a little lighter that bg selectBackground: a little darker that bg troughColor: a little darker that bg selectColor: yellow
For example to change a widget to have a red color scheme with a white foreground:
Pmw.Color.changecolor(widget, background = 'red3', foreground = 'white')
The colors of widgets created after this call will not be affected.
Note that widget must be a Tk widget or toplevel. To change the color of a Pmw megawidget, use it's hull component. For example:
widget = megawidget.component('hull') Pmw.Color.changecolor(widget, background = 'red3')
To do this, a few widgets are created as children of root, their defaults are queried, and then the widgets are destroyed. (Tk supplies no other way to get widget default values.)
Note that root must be a Tk widget or toplevel. To use a Pmw megawidget as the root, use it's hull component. For example:
root = megawidget.component('hull') Pmw.Color.getdefaultpalette(root)
For example to initialise an application to have a red color scheme with a white foreground:
Pmw.Color.setscheme(root, background = 'red3', foreground = 'white')
This function does not modify the colors of already existing widgets. Use Pmw.Color.changecolor() to do this.
Note that root must be a Tk widget or toplevel. To use the Tk option database of the root window or a Pmw megawidget, use the megawidget's hull component. For example:
root = megawidget.component('hull') Pmw.Color.setscheme(root, background = 'red3')
Home. Pmw 0.8.4 Maintainer firstname.lastname@example.org. 12 May 2000