Cogs.Core
web_color.h
1#ifndef LH_WEB_COLOR_H
2#define LH_WEB_COLOR_H
3
4namespace litehtml
5{
6 struct def_color
7 {
8 const tchar_t* name;
9 const tchar_t* rgb;
10 };
11
12 extern def_color g_def_colors[];
13
15
16 struct web_color
17 {
18 byte blue;
19 byte green;
20 byte red;
21 byte alpha;
22
23 web_color(byte r, byte g, byte b, byte a = 255)
24 {
25 blue = b;
26 green = g;
27 red = r;
28 alpha = a;
29 }
30
31 web_color()
32 {
33 blue = 0;
34 green = 0;
35 red = 0;
36 alpha = 0xFF;
37 }
38
39 web_color(const web_color& val)
40 {
41 blue = val.blue;
42 green = val.green;
43 red = val.red;
44 alpha = val.alpha;
45 }
46
47 web_color& operator=(const web_color& val)
48 {
49 blue = val.blue;
50 green = val.green;
51 red = val.red;
52 alpha = val.alpha;
53 return *this;
54 }
55 static web_color from_string(const tchar_t* str, litehtml::document_container* callback);
56 static litehtml::tstring resolve_name(const tchar_t* name, litehtml::document_container* callback);
57 static bool is_color(const tchar_t* str);
58 };
59}
60
61#endif // LH_WEB_COLOR_H