GwyColorSwatch: Gwyddion Widgets Library Reference Manual

## GwyColorSwatch GwyColorSwatch — A swatch displaying a colour |

## Functions

GtkWidget * | gwy_color_swatch_new ()
void | gwy_color_swatch_set_color ()
void | gwy_color_swatch_get_color ()
void | gwy_color_swatch_set_use_alpha ()
gboolean | gwy_color_swatch_get_use_alpha ()

## Properties

GwyRGBA * | color | Read / Write
gboolean | use-alpha | Read / Write

## Types and Values

struct | GwyColorSwatch
struct | GwyColorSwatchClass

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GwyColorSwatch

## Implemented Interfaces

GwyColorSwatch implements AtkImplementorIface and GtkBuildable.

## Includes

    #include <libgwyui/gwyui.h>

## Description

The widget is a simple rectangle displaying a colour, with some support for visualisation of the alpha value. It is usually not useful standalone, but can be a part of more complex colour manipulation widgets.

## Functions

### gwy_color_swatch_new()

    GtkWidget *
    gwy_color_swatch_new (void);

Creates a new color swatch.

#### Returns

A new color swatch.

### gwy_color_swatch_set_color()

    void
    gwy_color_swatch_set_color (GwyColorSwatch *swatch,
                                const GwyRGBA *color);

Sets the current colour of a colour swatch.

#### Parameters

swatch | A colour swatch. |
color | The colour to display as GwyRGBA. |

### gwy_color_swatch_get_color()

    void
    gwy_color_swatch_get_color (GwyColorSwatch *swatch,
                                GwyRGBA *color);

Obtains the current colour of a colour swatch.

#### Parameters

swatch | A colour swatch. |
color | Location to fill in with the current colour. |

### gwy_color_swatch_set_use_alpha()

    void
    gwy_color_swatch_set_use_alpha (GwyColorSwatch *swatch,
                                    gboolean use_alpha);

Sets whether the colour swatch should use the alpha channel.

#### Parameters

swatch | A colour swatch. |
use_alpha | `TRUE` if colour swatch should visualise the alpha channel, `FALSE` to ignore it. |

### gwy_color_swatch_get_use_alpha()

    gboolean
    gwy_color_swatch_get_use_alpha (GwyColorSwatch *swatch);

Reports whether the colour swatch uses the alpha channel.

#### Parameters

swatch | A colour swatch. |

#### Returns

`TRUE` if the colour swatch visualises alpha channel, `FALSE` if it ignores it.

## Types and Values

### struct GwyColorSwatch

    struct GwyColorSwatch;

### struct GwyColorSwatchClass

    struct GwyColorSwatchClass {
        GtkWidgetClass parent_class;
    };

## Property Details

### The `“color”` property

      “color”                    GwyRGBA *

Color to display.

Owner: GwyColorSwatch

Flags: Read / Write

### The `“use-alpha”` property

      “use-alpha”                gboolean

Whether to display the color with an alpha value.

Owner: GwyColorSwatch

Flags: Read / Write

Default value: FALSE