-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcolor.h
48 lines (37 loc) · 768 Bytes
/
color.h
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
40
41
42
43
44
45
46
47
48
#pragma once
#include "config.h"
#ifdef BOARD_M5CORE
#include <M5Stack.h>
#endif
#ifdef BOARD_M5CORE2
#include <M5Core2.h>
#endif
#include <LovyanGFX.h>
#include <ArduinoJson.h>
class Color
{
const uint8_t _red;
const uint8_t _green;
const uint8_t _blue;
public:
static Color fromJson(JsonVariant& json_color);
Color(const uint8_t red, const uint8_t green, const uint8_t blue) : _red(red), _green(green), _blue(blue)
{
}
const uint8_t getRed() const
{
return _red;
}
const uint8_t getGreen() const
{
return _green;
}
const uint8_t getBlue() const
{
return _blue;
}
const uint32_t getRGB888() const
{
return (_red << 16) + (_green << 8) + _blue;
}
};