## GtkSymbolicColor

GtkSymbolicColor — Symbolic colors

## Synopsis

    #include <gtk/gtk.h>

                        GtkSymbolicColor;
    GtkSymbolicColor *  gtk_symbolic_color_new_literal      (const GdkRGBA *color);
    GtkSymbolicColor *  gtk_symbolic_color_new_name         (const gchar *name);
    GtkSymbolicColor *  gtk_symbolic_color_new_shade        (GtkSymbolicColor *color,
                                                             gdouble factor);
    GtkSymbolicColor *  gtk_symbolic_color_new_alpha        (GtkSymbolicColor *color,
                                                             gdouble factor);
    GtkSymbolicColor *  gtk_symbolic_color_new_mix          (GtkSymbolicColor *color1,
                                                             GtkSymbolicColor *color2,
                                                             gdouble factor);
    GtkSymbolicColor *  gtk_symbolic_color_ref              (GtkSymbolicColor *color);
    void                gtk_symbolic_color_unref            (GtkSymbolicColor *color);
    gboolean            gtk_symbolic_color_resolve          (GtkSymbolicColor *color,
                                                             GtkStyleProperties *props,
                                                             GdkRGBA *resolved_color);

## Description

GtkSymbolicColor is a boxed type that represents a symbolic color. It is the result of parsing a color expression. To obtain the color represented by a GtkSymbolicColor, it has to be resolved with `gtk_symbolic_color_resolve()`, which replaces all symbolic color references by the colors they refer to (in a given context) and evaluates mix, shade and other expressions, resulting in a GdkRGBA value.

It is not normally necessary to deal directly with GtkSymbolicColors, since they are mostly used behind the scenes by GtkStyleContext and GtkCssProvider.

## Details

### GtkSymbolicColor

    typedef struct _GtkSymbolicColor GtkSymbolicColor;

### gtk_symbolic_color_new_literal ()

    GtkSymbolicColor *  gtk_symbolic_color_new_literal      (const GdkRGBA *color);

Creates a symbolic color pointing to a literal color.

`color` : | a GdkRGBA
Returns : | a newly created GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_new_name ()

    GtkSymbolicColor *  gtk_symbolic_color_new_name         (const gchar *name);

Creates a symbolic color pointing to an unresolved named color. See `gtk_style_context_lookup_color()` and `gtk_style_properties_lookup_color()`.

`name` : | color name
Returns : | a newly created GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_new_shade ()

    GtkSymbolicColor *  gtk_symbolic_color_new_shade        (GtkSymbolicColor *color,
                                                             gdouble factor);

Creates a symbolic color defined as a shade of another color. A factor > 1.0 would resolve to a brighter color, while < 1.0 would resolve to a darker color.

`color` : | another GtkSymbolicColor
`factor` : | shading factor to apply to `color`
Returns : | A newly created GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_new_alpha ()

    GtkSymbolicColor *  gtk_symbolic_color_new_alpha        (GtkSymbolicColor *color,
                                                             gdouble factor);

Creates a symbolic color by modifying the relative alpha value of `color`. A factor < 1.0 would resolve to a more transparent color, while > 1.0 would resolve to a more opaque color.

`color` : | another GtkSymbolicColor
`factor` : | factor to apply to `color` alpha
Returns : | A newly created GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_new_mix ()

    GtkSymbolicColor *  gtk_symbolic_color_new_mix          (GtkSymbolicColor *color1,
                                                             GtkSymbolicColor *color2,
                                                             gdouble factor);

Creates a symbolic color defined as a mix of another two colors. a mix factor of 0 would resolve to `color1`, while a factor of 1 would resolve to `color2`.

`color1` : | color to mix
`color2` : | another color to mix
`factor` : | mix factor
Returns : | A newly created GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_ref ()

    GtkSymbolicColor *  gtk_symbolic_color_ref              (GtkSymbolicColor *color);

Increases the reference count of `color`

`color` : | a GtkSymbolicColor
Returns : | the same `color`

Since 3.0

### gtk_symbolic_color_unref ()

    void                gtk_symbolic_color_unref            (GtkSymbolicColor *color);

Decreases the reference count of `color`, freeing its memory if the reference count reaches 0.

`color` : | a GtkSymbolicColor

Since 3.0

### gtk_symbolic_color_resolve ()

    gboolean            gtk_symbolic_color_resolve          (GtkSymbolicColor *color,
                                                             GtkStyleProperties *props,
                                                             GdkRGBA *resolved_color);

If `color` is resolvable, `resolved_color` will be filled in with the resolved color, and `TRUE` will be returned. Generally, if `color` can't be resolved, it is due to it being defined on top of a named color that doesn't exist in `props`.

`props` must be non-`NULL` if `color` was created using `gtk_symbolic_color_named_new()`, but can be omitted in other cases.

`color` : | a GtkSymbolicColor
`props` : | GtkStyleProperties to use when resolving named colors, or `NULL`. [allow-none]
`resolved_color` : | return location for the resolved color. [out]
Returns : | `TRUE` if the color has been resolved

Since 3.0