### Struct

# Cogl Color

since: 13

#### Description [src]

    struct CoglColor {
      /* No available fields */
    }

A structure for holding a color definition. The contents of the CoglColor structure are private and should never by accessed directly.

Available since: 13

#### Constructors

###### cogl_color_new

Creates a new (empty) color.

since: 13

#### Functions

###### cogl_color_equal

Compares two `CoglColor`s and checks if they are the same.

since: 13

###### cogl_color_init_from_hsl

Converts a color expressed in HLS (hue, luminance and saturation) values into a `CoglColor`.

since: 13

#### Instance methods

###### cogl_color_copy

Creates a copy of `color`.

since: 13

###### cogl_color_free

Frees the resources allocated by `cogl_color_new()` and `cogl_color_copy()`

since: 13

###### cogl_color_get_alpha

Retrieves the alpha channel of `color` as a fixed point value between 0 and 1.0.

since: 13

###### cogl_color_get_alpha_byte

Retrieves the alpha channel of `color` as a byte value between 0 and 255

since: 13

###### cogl_color_get_alpha_float

Retrieves the alpha channel of `color` as a floating point value between 0.0 and 1.0

since: 13

###### cogl_color_get_blue

Retrieves the blue channel of `color` as a fixed point value between 0 and 1.0.

since: 13

###### cogl_color_get_blue_byte

Retrieves the blue channel of `color` as a byte value between 0 and 255

since: 13

###### cogl_color_get_blue_float

Retrieves the blue channel of `color` as a floating point value between 0.0 and 1.0

since: 13

###### cogl_color_get_green

Retrieves the green channel of `color` as a fixed point value between 0 and 1.0.

since: 13

###### cogl_color_get_green_byte

Retrieves the green channel of `color` as a byte value between 0 and 255

since: 13

###### cogl_color_get_green_float

Retrieves the green channel of `color` as a floating point value between 0.0 and 1.0

since: 13

###### cogl_color_get_red

Retrieves the red channel of `color` as a fixed point value between 0 and 1.0.

since: 13

###### cogl_color_get_red_byte

Retrieves the red channel of `color` as a byte value between 0 and 255

since: 13

###### cogl_color_get_red_float

Retrieves the red channel of `color` as a floating point value between 0.0 and 1.0

since: 13

###### cogl_color_init_from_4f

Sets the values of the passed channels into a `CoglColor`.

since: 13

###### cogl_color_init_from_4fv

Sets the values of the passed channels into a `CoglColor`.

since: 13

###### cogl_color_init_from_4ub

Sets the values of the passed channels into a `CoglColor`.

since: 13

###### cogl_color_premultiply

Converts a non-premultiplied color to a pre-multiplied color. For example, semi-transparent red is (1.0, 0, 0, 0.5) when non-premultiplied and (0.5, 0, 0, 0.5) when premultiplied.

since: 13

###### cogl_color_set_alpha

Sets the alpha channel of `color` to `alpha`.

since: 13

###### cogl_color_set_alpha_byte

Sets the alpha channel of `color` to `alpha`.

since: 13

###### cogl_color_set_alpha_float

Sets the alpha channel of `color` to `alpha`.

since: 13

###### cogl_color_set_blue

Sets the blue channel of `color` to `blue`.

since: 13

###### cogl_color_set_blue_byte

Sets the blue channel of `color` to `blue`.

since: 13

###### cogl_color_set_blue_float

Sets the blue channel of `color` to `blue`.

since: 13

###### cogl_color_set_green

Sets the green channel of `color` to `green`.

since: 13

###### cogl_color_set_green_byte

Sets the green channel of `color` to `green`.

since: 13

###### cogl_color_set_green_float

Sets the green channel of `color` to `green`.

since: 13

###### cogl_color_set_red

Sets the red channel of `color` to `red`.

since: 13

###### cogl_color_set_red_byte

Sets the red channel of `color` to `red`.

since: 13

###### cogl_color_set_red_float

Sets the red channel of `color` to `red`.

since: 13

###### cogl_color_to_hsl

Converts `color` to the HLS format.

since: 13

###### cogl_color_unpremultiply

Converts a pre-multiplied color to a non-premultiplied color. For example, semi-transparent red is (0.5, 0, 0, 0.5) when premultiplied and (1.0, 0, 0, 0.5) when non-premultiplied.

since: 13