Color

32-bit Color with alpha channel.

Header#include "nativeui/gfx/color.h"
Namespacenamespace nu
Typeclass

This class should be copied by value under most cases, since the underlying type is a simple uint32_t.

Constructors

Color()

Create a black color.

Color(const std::string& hex)

Create color from hex string, like "#A123", "#123", "#AA112233", "#112233".

Parameters

Color(uint32_t value)

Create color from raw ARGB value.

Parameters

Color(unsigned a, unsigned r, unsigned g, unsigned b)

Create an ARGB color.

Parameters

Color(unsigned r, unsigned g, unsigned b)

Create an opaque RGB color.

Parameters

Methods

uint32_t value() const

Return raw RGBA value.

Return

uint32_t

unsigned a() const

Return alpha channel value.

Return

unsigned

unsigned r() const

Return red channel value.

Return

unsigned

unsigned g() const

Return green channel value.

Return

unsigned

unsigned b() const

Return blue channel value.

Return

unsigned

bool transparent() const

Return whether color is transparent.

Return

bool