Previous: GTK Names in Emacs, Up: GTK resources
Here is an example of two GTK+ style declarations:
pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps" style "default" { font_name = "helvetica 12" bg[NORMAL] = { 0.83, 0.80, 0.73 } bg[SELECTED] = { 0.0, 0.55, 0.55 } bg[INSENSITIVE] = { 0.77, 0.77, 0.66 } bg[ACTIVE] = { 0.0, 0.55, 0.55 } bg[PRELIGHT] = { 0.0, 0.55, 0.55 } fg[NORMAL] = "black" fg[SELECTED] = { 0.9, 0.9, 0.9 } fg[ACTIVE] = "black" fg[PRELIGHT] = { 0.9, 0.9, 0.9 } base[INSENSITIVE] = "#777766" text[INSENSITIVE] = { 0.60, 0.65, 0.57 } bg_pixmap[NORMAL] = "background.xpm" bg_pixmap[INSENSITIVE] = "background.xpm" bg_pixmap[ACTIVE] = "background.xpm" bg_pixmap[PRELIGHT] = "<none>" } style "ruler" = "default" { font_name = "helvetica 8" }
The style ‘ruler’ inherits from ‘default’. This way you can build on existing styles. The syntax for fonts and colors is described below.
As this example shows, it is possible to specify several values for foreground and background depending on the widget's state. The possible states are:
NORMAL
ACTIVE
bg[ACTIVE] = "red"
sets the scroll bar trough to red. Buttons that have been pressed but
not released yet (“armed”) are in this state.
PRELIGHT
SELECTED
INSENSITIVE
fg[INSENSITIVE] = "yellow"
.
Here are the things that can go in a style declaration:
bg[
state] =
colorbg
; it uses base
instead.
base[
state] =
colorbg_pixmap[
state] = "
pixmap"
You can't specify the file by its absolute file name. GTK looks for
the pixmap file in directories specified in pixmap_path
.
pixmap_path
is a colon-separated list of directories within
double quotes, specified at the top level in a gtkrc file
(i.e., not inside a style definition; see example above):
pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps"
fg[
state] =
colortext
.
text[
state] =
colorfont_name = "
font"
There are three ways to specify a color: a color name, an RGB
triplet, or a GTK-style RGB triplet. See Colors, for a description
of color names and RGB triplets. Color names should be enclosed with
double quotes, e.g., ‘"red"’. RGB triplets should be written
without double quotes, e.g., ‘#ff0000’. GTK-style RGB triplets
have the form {
r,
g,
b }
, where
r, g and b are either integers in the range 0–65535
or floats in the range 0.0–1.0.