Color
32-bit Color with alpha channel.
Header | #include "nativeui/gfx/color.h" |
Namespace | namespace nu |
Type | class |
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
const std::string&
hex
Color(uint32_t value)
Create color from raw ARGB value.
Parameters
uint32_t
value
Color(unsigned a, unsigned r, unsigned g, unsigned b)
Create an ARGB color.
Parameters
unsigned
a - 8-bit alpha channel value.unsigned
r - 8-bit red channel value.unsigned
g - 8-bit green channel value.unsigned
b - 8-bit blue channel value.
Color(unsigned r, unsigned g, unsigned b)
Create an opaque RGB color.
Parameters
unsigned
r - 8-bit red channel value.unsigned
g - 8-bit green channel value.unsigned
b - 8-bit blue channel value.
Class methods
Color Get(Color::Name name)
Return the color with theme name
.
Parameters
Color::Name
name
Return
Color
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