Subversion Repositories Kolibri OS

Rev

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

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