A theme_colour is a colour whose name describes its role
rather than its value, for example ui_window_background or
syntax_comment. It is derived from another colour, which is
the name of another theme colour or a system colour (sys_*),
or a colour object.
The xpce user interface and the development tools refer to theme
colours, either directly or by name, so they follow the selected theme
when its colours change:
?- new(_, theme_colour(my_highlight, khaki1)), send(new(P, picture), open), send(P, display, new(B, box(100, 100))), send(B, fill, my_highlight). ?- new(_, theme_colour(my_highlight, khaki4)), send(@display_manager, colours_changed).
The RGB value is computed when it is needed, by following
theme_colour<-derived_from
through other theme colours until an ordinary colour is found. Changing
what any theme colour is derived from, or reloading the system colours,
resets the RGB value of all theme colours, so each is resolved
again on its next use. Theme colours may therefore refer to each other
in any order and a theme colour may be created before the colour it
refers to. A cycle or an unknown colour name prints a warning and
resolves to grey50.
Theme colours are locked and never garbage collected. They are never
returned when looking up a colour from its RGB values (see
colour<-lookup),
because their value changes. All theme colours are in the chain @theme_colours.
xpce defines a number of theme colours itself, the ui_*
colours for the basic user interface elements and the ansi_*
colours of the terminal. They are created when the class is initialised.
Their values in the default light theme are in the hash
table
@theme_colour_defaults.
Themes are managed by the Prolog library
library(pce_theme). See the section Themes of the
XPCE User Guide.
|colourvalue because colour<-value
is the value of the HSV model. Either a colour name, which may be
the name of another theme colour, or a colour
object. The name #RRGGBB specifies an RGB value.
|colour<-rgba
is @default
until it is resolved. If a theme colour with this name exists, theme_colour<-lookup
returns it after setting
theme_colour->derived_from.|colourdisplay_manager ->colours_changed
after changing theme colours.|colour -> theme_colour->derived_from
and return it. This makes creating a theme colour again a way to change
it.