3#ifndef GDK_GRAPHICS_COLOR_H
4#define GDK_GRAPHICS_COLOR_H
8namespace gdk::graphics {
11 using channel_type = float;
13 channel_type r = 0, g = 0, b = 0, a = 1;
40 constexpr color(
const channel_type aR,
41 const channel_type aG,
42 const channel_type aB,
43 const channel_type aA = 1)
44 : r(aR), g(aG), b(aB), a(aA)
70 std::ostream &operator<<(std::ostream &stream,
const color &acolor);
74 inline const color
color::red{1.0f, 0.0f, 0.0f, 1.0f};
80 0.3921568627450980392156862745098f,
81 0.58431372549019607843137254901961f,
82 0.92941176470588235294117647058824f,
Represents a 4 channel color: {Red, Green, Blue, Alpha}.
Definition color.h:10
static const color red
opaque red color
Definition color.h:55
static const color dark_green
opaque dark green color
Definition color.h:59
void operator+=(const color &aOther)
add two colors together.
color(color &&)=default
move semantics
static const color blue
opaque blue color
Definition color.h:61
static const color deathly_pink
Definition color.h:64
static const color cornflower_blue
an opaque pastel blue color
Definition color.h:66
color(const color &)=default
copy semantics
color & operator=(const color &acolor)=default
copy semantics
constexpr bool operator==(const color &aOther) const =default
equality semantics
constexpr color(const channel_type aR, const channel_type aG, const channel_type aB, const channel_type aA=1)
constructs a color with provided channel values. Alpha has a default opaque value
Definition color.h:40
static const color white
opaque white color
Definition color.h:53
color()=default
constructs a color as opaque black
static const color green
opaque green color
Definition color.h:57
static const color black
opaque black color
Definition color.h:51
color & operator=(color &&acolor)=default
move semantics
void clamp()
clamp each channel to the [0 - 1] range