Subversion Repositories Kolibri OS

Rev

Rev 2884 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2413 leency 1
//Надо будет переделать на "дерево поиска" или, что-то подобное
2
//будет нечитабельно, зато меньше и быстее
3
 
2884 leency 4
struct color_spec {
5
	char *name;
6
	int rgb;
7
};
2413 leency 8
 
2884 leency 9
struct color_spec color_specs[] = {
10
	"aliceblue",		0xF0F8FF,
11
	"antiquewhite",	0xFAEBD7,
12
	"aqua",		0x00FFFF,
13
	"aquamarine",		0x7FFFD4,
14
	"azure",		0xF0FFFF,
15
	"beige",		0xF5F5DC,
16
	"bisque",		0xFFE4C4,
17
	"black",		0x000000,
18
	"blanchedalmond",	0xFFEBCD,
19
	"blue",		0x0000FF,
20
	"blueviolet",		0x8A2BE2,
21
	"brown",		0xA52A2A,
22
	"burlywood",		0xDEB887,
23
	"cadetblue",		0x5F9EA0,
24
	"chartreuse",		0x7FFF00,
25
	"chocolate",		0xD2691E,
26
	"coral",		0xFF7F50,
27
	"cornflowerblue",	0x6495ED,
28
	"cornsilk",		0xFFF8DC,
29
	"crimson",		0xDC143C,
30
	"cyan",		0x00FFFF,
31
	"darkblue",		0x00008B,
32
	"darkcyan",		0x008B8B,
33
	"darkgoldenrod",	0xB8860B,
34
	"darkgray",		0xA9A9A9,
35
	"darkgreen",		0x006400,
36
	"darkkhaki",		0xBDB76B,
37
	"darkmagenta",		0x8B008B,
38
	"darkolivegreen",	0x556B2F,
39
	"darkorange",		0xFF8C00,
40
	"darkorchid",		0x9932CC,
41
	"darkred",		0x8B0000,
42
	"darksalmon",		0xE9967A,
43
	"darkseagreen",	0x8FBC8F,
44
	"darkslateblue",	0x483D8B,
45
	"darkslategray",	0x2F4F4F,
46
	"darkturquoise",	0x00CED1,
47
	"darkviolet",		0x9400D3,
48
	"deeppink",		0xFF1493,
49
	"deepskyblue",		0x00BFFF,
50
	"dimgray",		0x696969,
51
	"dodgerblue",		0x1E90FF,
52
	"firebrick",		0xB22222,
53
	"floralwhite",		0xFFFAF0,
54
	"forestgreen",		0x228B22,
55
	"fuchsia",		0xFF00FF,
56
	"gainsboro",		0xDCDCDC,
57
	"ghostwhite",		0xF8F8FF,
58
	"gold",		0xFFD700,
59
	"goldenrod",		0xDAA520,
60
	"gray",		0x808080,
61
	"green",		0x008000,
62
	"greenyellow",		0xADFF2F,
63
	"honeydew",		0xF0FFF0,
64
	"hotpink",		0xFF69B4,
65
	"indianred",		0xCD5C5C,
66
	"indigo",		0x4B0082,
67
	"ivory",		0xFFFFF0,
68
	"khaki",		0xF0E68C,
69
	"lavender",		0xE6E6FA,
70
	"lavenderblush",	0xFFF0F5,
71
	"lawngreen",		0x7CFC00,
72
	"lemonchiffon",	0xFFFACD,
73
	"lightblue",		0xADD8E6,
74
	"lightcoral",		0xF08080,
75
	"lightcyan",		0xE0FFFF,
76
	"lightgoldenrodyellow",	0xFAFAD2,
77
	"lightgreen",		0x90EE90,
78
	"lightgrey",		0xD3D3D3,
79
	"lightpink",		0xFFB6C1,
80
	"lightsalmon",		0xFFA07A,
81
	"lightseagreen",	0x20B2AA,
82
	"lightskyblue",	0x87CEFA,
83
	"lightslategray",	0x778899,
84
	"lightsteelblue",	0xB0C4DE,
85
	"lightyellow",		0xFFFFE0,
86
	"lime",		0x00FF00,
87
	"limegreen",		0x32CD32,
88
	"linen",		0xFAF0E6,
89
	"magenta",		0xFF00FF,
90
	"maroon",		0x800000,
91
	"mediumaquamarine",	0x66CDAA,
92
	"mediumblue",		0x0000CD,
93
	"mediumorchid",	0xBA55D3,
94
	"mediumpurple",	0x9370DB,
95
	"mediumseagreen",	0x3CB371,
96
	"mediumslateblue",	0x7B68EE,
97
	"mediumspringgreen",	0x00FA9A,
98
	"mediumturquoise",	0x48D1CC,
99
	"mediumvioletred",	0xC71585,
100
	"midnightblue",	0x191970,
101
	"mintcream",		0xF5FFFA,
102
	"mistyrose",		0xFFE4E1,
103
	"moccasin",		0xFFE4B5,
104
	"navajowhite",		0xFFDEAD,
105
	"navy",		0x000080,
106
	"oldlace",		0xFDF5E6,
107
	"olive",		0x808000,
108
	"olivedrab",		0x6B8E23,
109
	"orange",		0xFFA500,
110
	"orangered",		0xFF4500,
111
	"orchid",		0xDA70D6,
112
	"palegoldenrod",	0xEEE8AA,
113
	"palegreen",		0x98FB98,
114
	"paleturquoise",	0xAFEEEE,
115
	"palevioletred",	0xDB7093,
116
	"papayawhip",		0xFFEFD5,
117
	"peachpuff",		0xFFDAB9,
118
	"peru",		0xCD853F,
119
	"pink",		0xFFC0CB,
120
	"plum",		0xDDA0DD,
121
	"powderblue",		0xB0E0E6,
122
	"purple",		0x800080,
123
	"red",			0xFF0000,
124
	"rosybrown",		0xBC8F8F,
125
	"royalblue",		0x4169E1,
126
	"saddlebrown",		0x8B4513,
127
	"salmon",		0xFA8072,
128
	"sandybrown",		0xF4A460,
129
	"seagreen",		0x2E8B57,
130
	"seashell",		0xFFF5EE,
131
	"sienna",		0xA0522D,
132
	"silver",		0xC0C0C0,
133
	"skyblue",		0x87CEEB,
134
	"slateblue",		0x6A5ACD,
135
	"slategray",		0x708090,
136
	"snow",		0xFFFAFA,
137
	"springgreen",		0x00FF7F,
138
	"steelblue",		0x4682B4,
139
	"tan",			0xD2B48C,
140
	"teal",		0x008080,
141
	"thistle",		0xD8BFD8,
142
	"tomato",		0xFF6347,
143
	"turquoise",		0x40E0D0,
144
	"violet",		0xEE82EE,
145
	"wheat",		0xF5DEB3,
146
	"white",		0xFFFFFF,
147
	"whitesmoke",		0xF5F5F5,
148
	"yellow",		0xFFFF00,
149
	"yellowgreen",		0x9ACD32,
150
0};
2413 leency 151
 
152
dword StrToCol(char* htmlcolor)
153
{
2884 leency 154
	dword j=1,
155
		color=0,
156
		textlen=0;
157
	char ch=0x00;
158
 
2885 leency 159
	if (ESBYTE[htmlcolor]<>'#') return text_colors[0];
2884 leency 160
 
2885 leency 161
	textlen = strlen(htmlcolor);
2884 leency 162
 
163
	if (textlen==7) || (textlen==4)
164
	{
165
		FOR (;  j
166
		{
167
			ch=ESBYTE[htmlcolor+j];
168
			IF ((ch>='0') && (ch<='9')) ch -= '0';
169
			IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
170
			IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
171
			color = color*0x10 + ch;
172
			if (textlen==4) color = color*0x10 + ch; //#abc ->> #aabbcc (слава википедии!!1)
173
		}
174
		return color;
175
	}
176
 
177
	return text_colors[0];
2413 leency 178
}
179
 
180
dword GetColor(char* color_str)
181
{
182
	int ii;
183
 
2884 leency 184
	if (ESBYTE[color_str] == '#')
2413 leency 185
		return StrToCol(color_str);
2884 leency 186
	else
187
		for (ii=0; color_specs[ii].name!=0; ii++)
2413 leency 188
		{
2884 leency 189
			if (!strcmp(color_str, color_specs[ii].name)) return color_specs[ii].rgb;
2413 leency 190
		}
2884 leency 191
 
2413 leency 192
	return text_colors[0];
193
}