GTK extends the CSS syntax with several additional ways to specify colors.

The first is a reference to a color defined via a define-color rule in CSS. The syntax for define-color rules is as follows:

define-color Name Color

To refer to the color defined by a define-color rule, prefix the name with @.

GTK also supports color expressions, which allow colors to be transformed to new ones. Color expressions can be nested, providing a rich language to define colors. Color expressions resemble functions, taking 1 or more colors and in some cases a number as arguments.


produces a brigher variant of Color


produces a darker variant of Color

shade(Color, Number)

changes the lightness of Color. The number ranges from 0 for black to 2 for white.

alpha(Color, Number)

replaces the alpha value of color with number (between 0 and 1)

mix(Color1, Color2, Number)

interpolates between the two colors