gtk.gdk.Color
gtk.gdk.Color — an object holding color information
Synopsis
class gtk.gdk.Color(gobject.GBoxed):
gtk.gdk.Color(red=0, green=0, blue=0, pixel=0)
|
Description
A gtk.gdk.Color
contains the values of a color that may or may not be allocated. The red,
green and blue attributes are specified by an unsigned integer in the range
0-65535. The pixel value is an index into the colormap that has allocated
the gtk.gdk.Color.
Typically a color is allocated by using the gdk.Colormap.alloc_color()
method. Unallocated colors can be used to specify the color attributes of
gtk.Style
objects since these colors will be allocated when an attempt is made to use
the gtk.Style
object.
Constructor
gtk.gdk.Color(red=0, green=0, blue=0, pixel=0)
|
red : | The red color component in the range
0-65535 |
green : | The green color component in the range
0-65535 |
blue : | The blue color component in the range
0-65535 |
pixel : | The index of the color when allocated in its
colormap |
Returns : | a new gtk.gdk.Color
object |
Creates a new gtk.gdk.Color object
with the color component values specified by red,
green and blue (all default to
0) and using the pixel value specified by pixel. The
value of pixel will be overwritten when the color is
allocated.
Functions
gtk.gdk.color_parse
def gtk.gdk.color_parse(spec)
|
spec : | a string containing a color
specification |
Returns : | a gtk.gdk.Color
object |
The gtk.gdk.color_parse() method returns
the gtk.gdk.Color
specified by spec. The format of
spec is a string containing the specification of the
color either as a name (e.g. "navajowhite") as specified in the X11
rgb.txt file or as a hexadecimal string (e.g.
"#FF0078"). The hexadecimal string must start with '#' and must contain 3
sets of hexadecimal digits of the same length (i.e. 1, 2 ,3 or 4 digits).
For example the following specify the same color value: "#F0A", "#FF00AA",
"#FFF000AAA" and "#FFFF0000AAAA". The gtk.gdk.Color is
not allocated.
This function raise the ValueError (TypeError prior to PyGTK
2.4) exception if unable to parse the color specification