-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcolor.h
More file actions
39 lines (29 loc) · 662 Bytes
/
color.h
File metadata and controls
39 lines (29 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef COLOR_H
#define COLOR_H
#include <stdint.h>
#include "nanovg.h"
struct Color;
bool operator!=(const Color& lhs, const Color& rhs);
struct Color
{
enum colors {
red = 0xFF0000FF,
green = 0x00FF00FF,
blue = 0x0000FFFF,
white = 0xFFFFFFFF,
black = 0x000000FF
};
static Color random();
constexpr Color(uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255)
: a(a), b(b), g(g), r(r)
{}
constexpr Color(uint32_t rgba): rgba(rgba) {}
NVGcolor vgColor() const;
union {
uint32_t rgba;
struct {
uint8_t a,b,g,r;
};
};
};
#endif // COLOR_H