color.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 ** Harry Storbacka
28 ** Mark Page
29 */
30 
31 
32 #pragma once
33 
34 #include "../../Core/Math/vec4.h"
35 #include <vector>
36 
37 namespace clan
38 {
41 
42 class PixelFormat;
43 class Colorf;
44 
46 class Color : public Vec4ub
47 {
50 
51 public:
54  Color() {}
55 
56  explicit Color(const Colorf&);
57 
67  Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha = 255)
68  : Vec4ub(red, green, blue, alpha) { return; }
69 
76  Color(const std::string &hexstr);
77 
81 
82 public:
84  unsigned char get_alpha() const { return a; }
85 
87  unsigned char get_red() const { return r; }
88 
90  unsigned char get_green() const { return g; }
91 
93  unsigned char get_blue() const { return b; }
94 
96  float get_alpha_f() const { return float(a) / 255.0f; }
97 
99  float get_red_f() const { return float(r) / 255.0f; }
100 
102  float get_green_f() const { return float(g) / 255.0f; }
103 
105  float get_blue_f() const { return float(b) / 255.0f; }
106 
108  unsigned int get_argb8() const { return (((unsigned int)a) << 24) | (((unsigned int)r) << 16) | (((unsigned int)g) << 8) | (unsigned int)b; }
109 
111  unsigned int get_abgr8() const { return (((unsigned int)a) << 24) | (((unsigned int)b) << 16) | (((unsigned int)g) << 8) | (unsigned int)r; }
112 
114  unsigned int get_rgba8() const { return (((unsigned int)r) << 24) | (((unsigned int)g) << 16) | (((unsigned int)b) << 8) | (unsigned int)a; }
115 
117  unsigned int get_bgra8() const { return (((unsigned int)b) << 24) | (((unsigned int)g) << 16) | (((unsigned int)r) << 8) | (unsigned int)a; }
118 
119 // Operations:
120 public:
122  bool operator==(const Color &c) const
123  {
124  return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
125  }
126 
128  bool operator!=(const Color &c) const
129  {
130  return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
131  }
132 
136 
137 public:
139  static Color aliceblue;
140 
143 
145  static Color aqua;
146 
149 
151  static Color azure;
152 
154  static Color beige;
155 
157  static Color bisque;
158 
160  static Color black;
161 
164 
166  static Color blue;
167 
170 
172  static Color brown;
173 
175  static Color burlywood;
176 
178  static Color cadetblue;
179 
182 
184  static Color chocolate;
185 
187  static Color coral;
188 
191 
193  static Color cornsilk;
194 
196  static Color crimson;
197 
199  static Color cyan;
200 
202  static Color darkblue;
203 
205  static Color darkcyan;
206 
209 
211  static Color darkgray;
212 
214  static Color darkgreen;
215 
217  static Color darkgrey;
218 
220  static Color darkkhaki;
221 
224 
227 
230 
233 
235  static Color darkred;
236 
239 
242 
245 
248 
251 
254 
257 
259  static Color deeppink;
260 
263 
265  static Color dimgray;
266 
268  static Color dimgrey;
269 
272 
274  static Color firebrick;
275 
278 
281 
283  static Color fuchsia;
284 
286  static Color gainsboro;
287 
290 
292  static Color gold;
293 
295  static Color goldenrod;
296 
298  static Color gray;
299 
301  static Color grey;
302 
304  static Color green;
305 
308 
310  static Color honeydew;
311 
313  static Color hotpink;
314 
316  static Color indianred;
317 
319  static Color indigo;
320 
322  static Color ivory;
323 
325  static Color khaki;
326 
328  static Color lavender;
329 
332 
334  static Color lawngreen;
335 
338 
340  static Color lightblue;
341 
344 
346  static Color lightcyan;
347 
350 
352  static Color lightgray;
353 
356 
358  static Color lightgrey;
359 
361  static Color lightpink;
362 
365 
368 
371 
374 
377 
380 
383 
385  static Color lime;
386 
388  static Color limegreen;
389 
391  static Color linen;
392 
394  static Color magenta;
395 
397  static Color maroon;
398 
401 
404 
407 
410 
413 
416 
419 
422 
425 
428 
430  static Color mintcream;
431 
433  static Color mistyrose;
434 
436  static Color moccasin;
437 
440 
442  static Color navy;
443 
445  static Color oldlace;
446 
448  static Color olive;
449 
451  static Color olivedrab;
452 
454  static Color orange;
455 
457  static Color orangered;
458 
460  static Color orchid;
461 
464 
466  static Color palegreen;
467 
470 
473 
476 
478  static Color peachpuff;
479 
481  static Color peru;
482 
484  static Color pink;
485 
487  static Color plum;
488 
491 
493  static Color purple;
494 
496  static Color red;
497 
499  static Color rosybrown;
500 
502  static Color royalblue;
503 
506 
508  static Color salmon;
509 
512 
514  static Color seagreen;
515 
517  static Color seashell;
518 
520  static Color sienna;
521 
523  static Color silver;
524 
526  static Color skyblue;
527 
529  static Color slateblue;
530 
532  static Color slategray;
533 
535  static Color slategrey;
536 
538  static Color snow;
539 
542 
544  static Color steelblue;
545 
547  static Color tan;
548 
550  static Color teal;
551 
553  static Color thistle;
554 
556  static Color tomato;
557 
559  static Color turquoise;
560 
562  static Color violet;
563 
565  static Color wheat;
566 
568  static Color white;
569 
572 
574  static Color yellow;
575 
578 
581 
582  static Color gray10;
583  static Color gray20;
584  static Color gray30;
585  static Color gray40;
586  static Color gray50;
587  static Color gray60;
588  static Color gray70;
589  static Color gray80;
590  static Color gray90;
591 
597  static Color find_color(const std::string &name);
598 
600  static std::vector<std::string> &get_names();
601 
605 
606 public:
608  void set_alpha(unsigned char value) { a = value; }
609 
611  void set_red(unsigned char value) { r = value; }
612 
614  void set_green(unsigned char value) { g = value; }
615 
617  void set_blue(unsigned char value) { b = value; }
618 
620  void set_alpha_f(float value) { a = (unsigned char) (value*255.0f); }
621 
623  void set_red_f(float value) { r = (unsigned char) (value*255.0f); }
624 
626  void set_green_f(float value) { g = (unsigned char) (value*255.0f); }
627 
629  void set_blue_f(float value) { b = (unsigned char) (value*255.0f); }
630 
632  void set_color(unsigned char new_red, unsigned char new_green, unsigned char new_blue, unsigned char new_alpha = 255)
633  { r = new_red; g = new_green; b = new_blue; a = new_alpha; }
634 
636  void set_rgba8(unsigned int color);
637 
639  void set_bgra8(unsigned int color);
640 
642  void set_rgb8(unsigned int color);
643 
645  void set_argb8(unsigned int color);
646 
648  void set_colorf(float new_red, float new_green, float new_blue, float new_alpha = 1.0f)
649  {
650  r = (unsigned char) (new_red * 255.0f);
651  g = (unsigned char) (new_green * 255.0f);
652  b = (unsigned char) (new_blue * 255.0f);
653  a = (unsigned char) (new_alpha * 255.0f);
654  }
655 
657 };
658 
660 class Colorf : public Vec4f
661 {
664 
665 public:
667  Colorf() : Vec4f(0.0f, 0.0f, 0.0f, 0.0f)
668  {
669  }
670 
680  Colorf(float r, float g, float b, float a = 1.0f) : Vec4f(r,g,b,a)
681  {
682  }
683 
690  Colorf(const float *array_rgba)
691  : Vec4f((array_rgba[0]), (array_rgba[1]), (array_rgba[2]), (array_rgba[3]))
692  {
693  }
694 
698  Colorf(const Vec4f &color) : Vec4f(color)
699  {
700  }
701 
711  Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
712  : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
713  {
714  }
715 
725  Colorf(int r, int g, int b, int a=255)
726  : Vec4f((r/255.0f), (g/255.0f), (b/255.0f), (a/255.0f))
727  {
728  }
729 
730  explicit Colorf(const Color& color)
731  : Vec4f((color.get_red()/255.0f), (color.get_green()/255.0f), (color.get_blue()/255.0f), (color.get_alpha()/255.0f))
732  {
733  }
734 
741  Colorf(const std::string &hexstr)
742  {
743  *this = (Colorf)Color::find_color(hexstr);
744  }
745 
749 
750 public:
751 
755  float get_red() const { return r; }
756 
760  float get_green() const { return g; }
761 
765  float get_blue() const { return b; }
766 
770  float get_alpha() const { return a; }
771 
775 
776 public:
778  void normalize()
779  {
780  r = (r < 0.0f) ? 0.0f : ((r > 1.0f) ? 1.0f : r);
781  g = (g < 0.0f) ? 0.0f : ((g > 1.0f) ? 1.0f : g);
782  b = (b < 0.0f) ? 0.0f : ((b > 1.0f) ? 1.0f : b);
783  a = (a < 0.0f) ? 0.0f : ((a > 1.0f) ? 1.0f : a);
784  }
785 
787  void set_alpha(float value) { a = value; }
788 
790  void set_red(float value) { r = value; }
791 
793  void set_green(float value) { g= value; }
794 
796  void set_blue(float value) { b = value; }
797 
799  bool operator==(const Colorf &c) const
800  {
801  return (r == c.r) && (g == c.g) && (b == c.b) && (a == c.a);
802  }
803 
805  bool operator!=(const Colorf &c) const
806  {
807  return (r != c.r) || (g != c.g) || (b != c.b) || (a != c.a);
808  }
809 
811  operator Color() const
812  {
813  return Color(*this);
814  }
815 
819 
820 public:
823 
826 
828  static Colorf aqua;
829 
832 
834  static Colorf azure;
835 
837  static Colorf beige;
838 
840  static Colorf bisque;
841 
843  static Colorf black;
844 
847 
849  static Colorf blue;
850 
853 
855  static Colorf brown;
856 
859 
862 
865 
868 
870  static Colorf coral;
871 
874 
876  static Colorf cornsilk;
877 
879  static Colorf crimson;
880 
882  static Colorf cyan;
883 
885  static Colorf darkblue;
886 
888  static Colorf darkcyan;
889 
892 
894  static Colorf darkgray;
895 
898 
900  static Colorf darkgrey;
901 
904 
907 
910 
913 
916 
918  static Colorf darkred;
919 
922 
925 
928 
931 
934 
937 
940 
942  static Colorf deeppink;
943 
946 
948  static Colorf dimgray;
949 
951  static Colorf dimgrey;
952 
955 
958 
961 
964 
966  static Colorf fuchsia;
967 
970 
973 
975  static Colorf gold;
976 
979 
981  static Colorf gray;
982 
984  static Colorf grey;
985 
987  static Colorf green;
988 
991 
993  static Colorf honeydew;
994 
996  static Colorf hotpink;
997 
1000 
1002  static Colorf indigo;
1003 
1005  static Colorf ivory;
1006 
1008  static Colorf khaki;
1009 
1012 
1015 
1018 
1021 
1024 
1027 
1030 
1033 
1036 
1039 
1042 
1045 
1048 
1051 
1054 
1057 
1060 
1063 
1066 
1068  static Colorf lime;
1069 
1072 
1074  static Colorf linen;
1075 
1077  static Colorf magenta;
1078 
1080  static Colorf maroon;
1081 
1084 
1087 
1090 
1093 
1096 
1099 
1102 
1105 
1108 
1111 
1114 
1117 
1120 
1123 
1125  static Colorf navy;
1126 
1128  static Colorf oldlace;
1129 
1131  static Colorf olive;
1132 
1135 
1137  static Colorf orange;
1138 
1141 
1143  static Colorf orchid;
1144 
1147 
1150 
1153 
1156 
1159 
1162 
1164  static Colorf peru;
1165 
1167  static Colorf pink;
1168 
1170  static Colorf plum;
1171 
1174 
1176  static Colorf purple;
1177 
1179  static Colorf red;
1180 
1183 
1186 
1189 
1191  static Colorf salmon;
1192 
1195 
1198 
1201 
1203  static Colorf sienna;
1204 
1206  static Colorf silver;
1207 
1209  static Colorf skyblue;
1210 
1213 
1216 
1219 
1221  static Colorf snow;
1222 
1225 
1228 
1230  static Colorf tan;
1231 
1233  static Colorf teal;
1234 
1236  static Colorf thistle;
1237 
1239  static Colorf tomato;
1240 
1243 
1245  static Colorf violet;
1246 
1248  static Colorf wheat;
1249 
1251  static Colorf white;
1252 
1255 
1257  static Colorf yellow;
1258 
1261 
1264 
1265  static Colorf gray10;
1266  static Colorf gray20;
1267  static Colorf gray30;
1268  static Colorf gray40;
1269  static Colorf gray50;
1270  static Colorf gray60;
1271  static Colorf gray70;
1272  static Colorf gray80;
1273  static Colorf gray90;
1275 };
1276 
1277 }
1278 
static Colorf midnightblue
Definition: color.h:1110
static Color antiquewhite
Definition: color.h:142
static Colorf oldlace
Definition: color.h:1128
static Color darkorange
Definition: color.h:229
static Colorf steelblue
Definition: color.h:1227
static Color slateblue
Definition: color.h:529
static Color papayawhip
Definition: color.h:475
static Colorf darkturquoise
Definition: color.h:936
static Colorf greenyellow
Definition: color.h:990
static Colorf darkolivegreen
Definition: color.h:909
static Colorf transparent
rgba(0, 0, 0, 0).
Definition: color.h:1263
static Colorf pink
Definition: color.h:1167
Colorf(const std::string &hexstr)
Constructs a color.
Definition: color.h:741
static Color darkolivegreen
Definition: color.h:226
Color()
Constructs a color.
Definition: color.h:54
static Colorf gainsboro
Definition: color.h:969
static Colorf blanchedalmond
Definition: color.h:846
void normalize()
Normalize the color by ensuring that all color values lie inbetween (0.0, 1.0)
Definition: color.h:778
static Color floralwhite
Definition: color.h:277
static Color lightgoldenrodyellow
Definition: color.h:349
static Color aliceblue
Definition: color.h:139
static Colorf lightcoral
Definition: color.h:1026
static Color turquoise
Definition: color.h:559
static Colorf red
Definition: color.h:1179
static Colorf mediumpurple
Definition: color.h:1092
static Colorf mediumorchid
Definition: color.h:1089
static Color lightslategrey
Definition: color.h:376
static Colorf cornflowerblue
Definition: color.h:873
static Colorf salmon
Definition: color.h:1191
static Color springgreen
Definition: color.h:541
static Colorf hotpink
Definition: color.h:996
static Color darkred
Definition: color.h:235
static Color cornsilk
Definition: color.h:193
static Color mediumturquoise
Definition: color.h:421
static Color lightseagreen
Definition: color.h:367
static Color burlywood
Definition: color.h:175
static Color dimgray
Definition: color.h:265
static Colorf mediumturquoise
Definition: color.h:1104
static Color darkgoldenrod
Definition: color.h:208
static Color steelblue
Definition: color.h:544
static Colorf firebrick
Definition: color.h:957
static Colorf lightpink
Definition: color.h:1044
static Color goldenrod
Definition: color.h:295
static Color ghostwhite
Definition: color.h:289
unsigned int get_bgra8() const
Returns the color in BGRA8888 format.
Definition: color.h:117
static Color oldlace
Definition: color.h:445
static Colorf papayawhip
Definition: color.h:1158
float get_alpha_f() const
Returns the alpha color component, in the range 0-1.
Definition: color.h:96
static Color indianred
Definition: color.h:316
static Colorf green
Definition: color.h:987
static Color lightcyan
Definition: color.h:346
static Color silver
Definition: color.h:523
static Color darkseagreen
Definition: color.h:241
static Colorf orchid
Definition: color.h:1143
static Colorf chocolate
Definition: color.h:867
static Colorf gold
Definition: color.h:975
static Color mediumseagreen
Definition: color.h:412
static Colorf brown
Definition: color.h:855
static Color darkviolet
Definition: color.h:256
static Color tomato
Definition: color.h:556
static Colorf mistyrose
Definition: color.h:1116
void set_green_f(float value)
Set green color component, in the range 0-1.
Definition: color.h:626
static Color gray40
Definition: color.h:585
static Colorf lightgray
Definition: color.h:1035
static Colorf cyan
Definition: color.h:882
static Colorf mediumslateblue
Definition: color.h:1098
static Color fuchsia
Definition: color.h:283
static Colorf gray
Definition: color.h:981
static Color palevioletred
Definition: color.h:472
static Color mediumvioletred
Definition: color.h:424
static Color lightsalmon
Definition: color.h:364
static Color limegreen
Definition: color.h:388
void set_bgra8(unsigned int color)
Set color based on rgba color components.
static Color bisque
Definition: color.h:157
static Color peru
Definition: color.h:481
static Color orangered
Definition: color.h:457
Type g
Definition: vec4.h:81
static Colorf darkblue
Definition: color.h:885
static Color darkgray
Definition: color.h:211
Colorf(float r, float g, float b, float a=1.0f)
Constructs a color.
Definition: color.h:680
static Color lawngreen
Definition: color.h:334
Type r
Definition: vec4.h:80
static Colorf silver
Definition: color.h:1206
static Colorf cadetblue
Definition: color.h:861
static Color grey
Definition: color.h:301
Colorf()
Constructs a color.
Definition: color.h:667
static Color plum
Definition: color.h:487
static Colorf gray60
Definition: color.h:1270
static Color mediumslateblue
Definition: color.h:415
static Color red
Definition: color.h:496
static Colorf olive
Definition: color.h:1131
static Color brown
Definition: color.h:172
static Colorf darkkhaki
Definition: color.h:903
static Color gray
Definition: color.h:298
static Color khaki
Definition: color.h:325
static Color lightslategray
Definition: color.h:373
static Color thistle
Definition: color.h:553
static Colorf lemonchiffon
Definition: color.h:1020
static Color chocolate
Definition: color.h:184
static Colorf whitesmoke
Definition: color.h:1254
static Color pink
Definition: color.h:484
static Color lavenderblush
Definition: color.h:331
static Colorf powderblue
Definition: color.h:1173
static Color seagreen
Definition: color.h:514
static Colorf slategrey
Definition: color.h:1218
static Colorf skyblue
Definition: color.h:1209
static Color find_color(const std::string &name)
Find and returns the static color matching a string.
static Color gray90
Definition: color.h:590
static Color gray20
Definition: color.h:583
static Colorf lightslategray
Definition: color.h:1056
static Colorf khaki
Definition: color.h:1008
static Color teal
Definition: color.h:550
Floating point color description class (for float).
Definition: color.h:661
static Color navajowhite
Definition: color.h:439
static Colorf purple
Definition: color.h:1176
static Colorf beige
Definition: color.h:837
static Color lightsteelblue
Definition: color.h:379
static Color linen
Definition: color.h:391
static Colorf dimgrey
Definition: color.h:951
static Colorf darkorange
Definition: color.h:912
static Color coral
Definition: color.h:187
static Color honeydew
Definition: color.h:310
static Colorf gray10
Definition: color.h:1265
static Colorf snow
Definition: color.h:1221
static Colorf deepskyblue
Definition: color.h:945
static Colorf ghostwhite
Definition: color.h:972
static Colorf mediumaquamarine
Definition: color.h:1083
static Color lightpink
Definition: color.h:361
static Color darkslateblue
Definition: color.h:244
void set_rgb8(unsigned int color)
Set color based on rgb color components. Alpha is set to 255.
static Color forestgreen
Definition: color.h:280
static Color cornflowerblue
Definition: color.h:190
static Color lime
Definition: color.h:385
static Colorf grey
Definition: color.h:984
static Colorf tomato
Definition: color.h:1239
static Colorf lightsalmon
Definition: color.h:1047
static Colorf mintcream
Definition: color.h:1113
void set_red(unsigned char value)
Set red color component, in the range 0-255.
Definition: color.h:611
static Colorf royalblue
Definition: color.h:1185
static Colorf lightsteelblue
Definition: color.h:1062
bool operator!=(const Color &c) const
Color != Color operator (deep compare)
Definition: color.h:128
static Color purple
Definition: color.h:493
static Colorf sienna
Definition: color.h:1203
static Color ivory
Definition: color.h:322
static Colorf lightgrey
Definition: color.h:1041
Color(const std::string &hexstr)
Constructs a color.
static Colorf yellowgreen
Definition: color.h:1260
static Color palegreen
Definition: color.h:466
static Colorf coral
Definition: color.h:870
Color description class.
Definition: color.h:47
Colorf(unsigned char r, unsigned char g, unsigned char b, unsigned char a=255)
Constructs a color.
Definition: color.h:711
static Colorf floralwhite
Definition: color.h:960
Colorf(const Vec4f &color)
Constructs a color.
Definition: color.h:698
unsigned int get_argb8() const
Returns the color in ARGB8888 format.
Definition: color.h:108
static Colorf seagreen
Definition: color.h:1197
static Colorf darkgoldenrod
Definition: color.h:891
static Color slategrey
Definition: color.h:535
static Colorf tan
Definition: color.h:1230
float get_blue_f() const
Returns the blue color component, in the range 0-1.
Definition: color.h:105
static Colorf gray50
Definition: color.h:1269
static Color mediumpurple
Definition: color.h:409
static Color gray80
Definition: color.h:589
static Color lavender
Definition: color.h:328
static Color cadetblue
Definition: color.h:178
static Colorf thistle
Definition: color.h:1236
unsigned int get_abgr8() const
Returns the color in ABGR8888 format.
Definition: color.h:111
static Color yellowgreen
Definition: color.h:577
static Color indigo
Definition: color.h:319
static Color darkorchid
Definition: color.h:232
static Color palegoldenrod
Definition: color.h:463
unsigned char get_red() const
Returns the red color component, in the range 0-255.
Definition: color.h:87
static Colorf fuchsia
Definition: color.h:966
static Color maroon
Definition: color.h:397
static Colorf chartreuse
Definition: color.h:864
void set_red_f(float value)
Set red color component, in the range 0-1.
Definition: color.h:623
static Color rosybrown
Definition: color.h:499
static Colorf bisque
Definition: color.h:840
static Colorf lightskyblue
Definition: color.h:1053
static Colorf palegreen
Definition: color.h:1149
static Color orange
Definition: color.h:454
static Color transparent
rgba(0, 0, 0, 0).
Definition: color.h:580
unsigned int get_rgba8() const
Returns the color in RGBA8888 format.
Definition: color.h:114
static Color violet
Definition: color.h:562
void set_green(float value)
Set green color component, in the range 0-1.
Definition: color.h:793
static Color deepskyblue
Definition: color.h:262
static Colorf darksalmon
Definition: color.h:921
unsigned char get_green() const
Returns the green color component, in the range 0-255.
Definition: color.h:90
static Color gray60
Definition: color.h:587
Colorf(const float *array_rgba)
Constructs a color.
Definition: color.h:690
void set_color(unsigned char new_red, unsigned char new_green, unsigned char new_blue, unsigned char new_alpha=255)
Set color based on rgba color components in the range 0-255.
Definition: color.h:632
static Color cyan
Definition: color.h:199
void set_alpha_f(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:620
static Colorf azure
Definition: color.h:834
static Color lightgray
Definition: color.h:352
static Colorf forestgreen
Definition: color.h:963
static Colorf dodgerblue
Definition: color.h:954
static Colorf sandybrown
Definition: color.h:1194
Type a
Definition: vec4.h:83
static Color lightyellow
Definition: color.h:382
static Color mediumorchid
Definition: color.h:406
static Colorf lightyellow
Definition: color.h:1065
static Colorf turquoise
Definition: color.h:1242
static Colorf olivedrab
Definition: color.h:1134
static Colorf plum
Definition: color.h:1170
void set_red(float value)
Set red color component, in the range 0-1.
Definition: color.h:790
static Color wheat
Definition: color.h:565
static Colorf linen
Definition: color.h:1074
static Colorf darkmagenta
Definition: color.h:906
static Color navy
Definition: color.h:442
static Color mintcream
Definition: color.h:430
static Color darkturquoise
Definition: color.h:253
static Color darkgrey
Definition: color.h:217
static Color deeppink
Definition: color.h:259
static Colorf crimson
Definition: color.h:879
static Color magenta
Definition: color.h:394
static Colorf lawngreen
Definition: color.h:1017
static Color azure
Definition: color.h:151
static Color mediumaquamarine
Definition: color.h:400
static Colorf navy
Definition: color.h:1125
void set_green(unsigned char value)
Set green color component, in the range 0-255.
Definition: color.h:614
static Colorf darkslategrey
Definition: color.h:933
static Colorf wheat
Definition: color.h:1248
static Colorf lavenderblush
Definition: color.h:1014
static Colorf maroon
Definition: color.h:1080
static Color lightcoral
Definition: color.h:343
static Color salmon
Definition: color.h:508
static Colorf darkred
Definition: color.h:918
float get_green_f() const
Returns the green color component, in the range 0-1.
Definition: color.h:102
static Colorf gray40
Definition: color.h:1268
static Color darkkhaki
Definition: color.h:220
static Color skyblue
Definition: color.h:526
4D vector
Definition: size.h:47
static Colorf violet
Definition: color.h:1245
static Colorf lightcyan
Definition: color.h:1029
static Color lemonchiffon
Definition: color.h:337
static Color blueviolet
Definition: color.h:169
static Color dodgerblue
Definition: color.h:271
static Colorf lightgoldenrodyellow
Definition: color.h:1032
static Colorf ivory
Definition: color.h:1005
Color(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha=255)
Constructs a color.
Definition: color.h:67
static Colorf darkseagreen
Definition: color.h:924
static Colorf mediumblue
Definition: color.h:1086
static Colorf slateblue
Definition: color.h:1212
static Colorf darkslateblue
Definition: color.h:927
static Color beige
Definition: color.h:154
static Colorf seashell
Definition: color.h:1200
static Colorf paleturquoise
Definition: color.h:1152
static Color royalblue
Definition: color.h:502
static Colorf blueviolet
Definition: color.h:852
Color(const Colorf &)
static Colorf blue
Definition: color.h:849
void set_blue(unsigned char value)
Set blue color component, in the range 0-255.
Definition: color.h:617
static Color blue
Definition: color.h:166
Definition: clanapp.h:36
static Color moccasin
Definition: color.h:436
static Color green
Definition: color.h:304
static Color white
Definition: color.h:568
void set_argb8(unsigned int color)
Set color based on argb color components.
static Colorf antiquewhite
Definition: color.h:825
static Colorf limegreen
Definition: color.h:1071
static Color paleturquoise
Definition: color.h:469
static Color black
Definition: color.h:160
static Color darkgreen
Definition: color.h:214
static Color yellow
Definition: color.h:574
static Colorf mediumvioletred
Definition: color.h:1107
static Color dimgrey
Definition: color.h:268
static Colorf darkgray
Definition: color.h:894
static Colorf palegoldenrod
Definition: color.h:1146
static Color snow
Definition: color.h:538
void set_rgba8(unsigned int color)
Set color based on rgba color components.
float get_green() const
Get Green.
Definition: color.h:760
bool operator==(const Colorf &c) const
Color == Color operator (deep compare)
Definition: color.h:799
static Colorf honeydew
Definition: color.h:993
static Colorf slategray
Definition: color.h:1215
static Colorf rosybrown
Definition: color.h:1182
void set_blue(float value)
Set blue color component, in the range 0-1.
Definition: color.h:796
static Colorf darkorchid
Definition: color.h:915
static Colorf burlywood
Definition: color.h:858
Type b
Definition: vec4.h:82
static Colorf darkslategray
Definition: color.h:930
static Colorf black
Definition: color.h:843
static Color darksalmon
Definition: color.h:238
static Colorf lightseagreen
Definition: color.h:1050
static Colorf dimgray
Definition: color.h:948
unsigned char get_alpha() const
Returns the alpha color component, in the range 0-255.
Definition: color.h:84
static Color lightblue
Definition: color.h:340
static Color midnightblue
Definition: color.h:427
static Colorf aqua
Definition: color.h:828
static Colorf lightgreen
Definition: color.h:1038
static Color tan
Definition: color.h:547
static Colorf magenta
Definition: color.h:1077
static Colorf aliceblue
Definition: color.h:822
static Colorf darkviolet
Definition: color.h:939
static Color darkcyan
Definition: color.h:205
static Colorf gray20
Definition: color.h:1266
static Colorf yellow
Definition: color.h:1257
Colorf(const Color &color)
Definition: color.h:730
static Color mediumblue
Definition: color.h:403
static Color darkslategrey
Definition: color.h:250
static Color firebrick
Definition: color.h:274
static Color mediumspringgreen
Definition: color.h:418
static Color sienna
Definition: color.h:520
static Color seashell
Definition: color.h:517
static Color lightgreen
Definition: color.h:355
static std::vector< std::string > & get_names()
Returns the names of static colors defined.
static Color orchid
Definition: color.h:460
static Colorf gray70
Definition: color.h:1271
float get_red_f() const
Returns the red color component, in the range 0-1.
Definition: color.h:99
static Color aqua
Definition: color.h:145
static Colorf springgreen
Definition: color.h:1224
static Color greenyellow
Definition: color.h:307
static Colorf gray80
Definition: color.h:1272
static Colorf orange
Definition: color.h:1137
float get_alpha() const
Get Alpha.
Definition: color.h:770
static Colorf orangered
Definition: color.h:1140
static Colorf peru
Definition: color.h:1164
static Colorf lightblue
Definition: color.h:1023
static Colorf moccasin
Definition: color.h:1119
float get_red() const
Get Red.
Definition: color.h:755
static Colorf goldenrod
Definition: color.h:978
static Colorf palevioletred
Definition: color.h:1155
static Colorf navajowhite
Definition: color.h:1122
static Colorf indianred
Definition: color.h:999
static Color darkmagenta
Definition: color.h:223
void set_alpha(unsigned char value)
Set alpha color component, in the range 0-255.
Definition: color.h:608
static Colorf gray90
Definition: color.h:1273
static Color gold
Definition: color.h:292
static Color blanchedalmond
Definition: color.h:163
static Color darkblue
Definition: color.h:202
static Color gray50
Definition: color.h:586
static Color whitesmoke
Definition: color.h:571
static Color lightgrey
Definition: color.h:358
bool operator!=(const Colorf &c) const
Color != Color operator (deep compare)
Definition: color.h:805
static Colorf gray30
Definition: color.h:1267
float get_blue() const
Get Blue.
Definition: color.h:765
static Color gainsboro
Definition: color.h:286
unsigned char get_blue() const
Returns the blue color component, in the range 0-255.
Definition: color.h:93
static Color saddlebrown
Definition: color.h:505
static Color aquamarine
Definition: color.h:148
static Colorf peachpuff
Definition: color.h:1161
static Color mistyrose
Definition: color.h:433
static Colorf lavender
Definition: color.h:1011
static Color slategray
Definition: color.h:532
void set_colorf(float new_red, float new_green, float new_blue, float new_alpha=1.0f)
Set color based on rgba color components in the range 0-1.
Definition: color.h:648
static Colorf indigo
Definition: color.h:1002
static Color lightskyblue
Definition: color.h:370
void set_alpha(float value)
Set alpha color component, in the range 0-1.
Definition: color.h:787
static Colorf darkgreen
Definition: color.h:897
static Color hotpink
Definition: color.h:313
Colorf(int r, int g, int b, int a=255)
Constructs a color.
Definition: color.h:725
bool operator==(const Color &c) const
Color == Color operator (deep compare)
Definition: color.h:122
static Color chartreuse
Definition: color.h:181
static Color olivedrab
Definition: color.h:451
static Colorf darkcyan
Definition: color.h:888
@ color
value is an url
static Color powderblue
Definition: color.h:490
void set_blue_f(float value)
Set blue color component, in the range 0-1.
Definition: color.h:629
static Colorf saddlebrown
Definition: color.h:1188
static Colorf teal
Definition: color.h:1233
static Color sandybrown
Definition: color.h:511
static Color gray70
Definition: color.h:588
static Colorf cornsilk
Definition: color.h:876
static Colorf lime
Definition: color.h:1068
static Color gray30
Definition: color.h:584
static Colorf lightslategrey
Definition: color.h:1059
static Colorf mediumseagreen
Definition: color.h:1095
static Colorf deeppink
Definition: color.h:942
static Color gray10
Definition: color.h:582
static Color darkslategray
Definition: color.h:247
static Colorf mediumspringgreen
Definition: color.h:1101
static Colorf aquamarine
Definition: color.h:831
static Colorf white
Definition: color.h:1251
static Color peachpuff
Definition: color.h:478
static Color crimson
Definition: color.h:196
static Color olive
Definition: color.h:448
static Colorf darkgrey
Definition: color.h:900