Method

Gdk.RGBA.parse

Declaration [src]

gboolean
gdk_rgba_parse (
  GdkRGBA* rgba,
  const char* spec
)

Description [src]

Parses a textual representation of a color.

The string can be either one of:

  • A standard name (Taken from the X11 rgb.txt file).
  • A hexadecimal value in the form “#rgb”, “#rrggbb”, “#rrrgggbbb” or ”#rrrrggggbbbb”
  • A hexadecimal value in the form “#rgba”, “#rrggbbaa”, or ”#rrrrggggbbbbaaaa”
  • A RGB color in the form “rgb(r,g,b)” (In this case the color will have full opacity)
  • A RGBA color in the form “rgba(r,g,b,a)”

Where “r”, “g”, “b” and “a” are respectively the red, green, blue and alpha color values. In the last two cases, “r”, “g”, and “b” are either integers in the range 0 to 255 or percentage values in the range 0% to 100%, and a is a floating point value in the range 0 to 1.

Parameters

spec const char*
 

the string specifying the color

 Ownership is not transferred to the callee
 The string is a NUL terminated UTF-8 string

Return value

Returns: gboolean

TRUE if the parsing succeeded