blob: a42b416ca2275283022babe4b7a513fcea35b4de (
plain)
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
49
50
51
52
53
|
#ifndef LH_WEB_COLOR_H
#define LH_WEB_COLOR_H
namespace litehtml
{
struct def_color
{
const char* name;
const char* rgb;
};
extern def_color g_def_colors[];
class document_container;
struct web_color
{
byte red;
byte green;
byte blue;
byte alpha;
static const web_color transparent;
static const web_color black;
static const web_color white;
web_color(byte r, byte g, byte b, byte a = 255)
{
red = r;
green = g;
blue = b;
alpha = a;
}
web_color()
{
red = 0;
green = 0;
blue = 0;
alpha = 0xFF;
}
bool operator==(web_color color) const { return red == color.red && green == color.green && blue == color.blue && alpha == color.alpha; }
bool operator!=(web_color color) const { return !(*this == color); }
string to_string() const;
static web_color from_string(const string& str, document_container* callback);
static string resolve_name(const string& name, document_container* callback);
static bool is_color(const string& str, document_container* callback);
};
}
#endif // LH_WEB_COLOR_H
|