sassc 1.7.1 → 1.8.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -1
  3. data/ext/libsass/.gitignore +10 -6
  4. data/ext/libsass/.travis.yml +4 -1
  5. data/ext/libsass/GNUmakefile.am +88 -0
  6. data/ext/libsass/Makefile +157 -76
  7. data/ext/libsass/Makefile.conf +47 -0
  8. data/ext/libsass/Readme.md +13 -14
  9. data/ext/libsass/appveyor.yml +25 -41
  10. data/ext/libsass/configure.ac +20 -7
  11. data/ext/libsass/contrib/plugin.cpp +1 -1
  12. data/ext/libsass/include/sass.h +15 -0
  13. data/ext/libsass/{sass.h → include/sass/base.h} +17 -9
  14. data/ext/libsass/{sass_context.h → include/sass/context.h} +3 -1
  15. data/ext/libsass/{sass_functions.h → include/sass/functions.h} +4 -4
  16. data/ext/libsass/{sass_interface.h → include/sass/interface.h} +5 -2
  17. data/ext/libsass/{sass_values.h → include/sass/values.h} +15 -1
  18. data/ext/libsass/{sass_version.h → include/sass/version.h} +0 -0
  19. data/ext/libsass/{sass_version.h.in → include/sass/version.h.in} +0 -0
  20. data/ext/libsass/{sass2scss.h → include/sass2scss.h} +6 -7
  21. data/ext/libsass/m4/m4-ax_cxx_compile_stdcxx_11.m4 +167 -0
  22. data/ext/libsass/script/ci-build-libsass +67 -23
  23. data/ext/libsass/src/GNUmakefile.am +54 -0
  24. data/ext/libsass/src/ast.cpp +2029 -0
  25. data/ext/libsass/{ast.hpp → src/ast.hpp} +832 -660
  26. data/ext/libsass/src/ast_def_macros.hpp +47 -0
  27. data/ext/libsass/src/ast_factory.hpp +93 -0
  28. data/ext/libsass/{ast_fwd_decl.hpp → src/ast_fwd_decl.hpp} +9 -4
  29. data/ext/libsass/{b64 → src/b64}/cencode.h +1 -1
  30. data/ext/libsass/{b64 → src/b64}/encode.h +0 -0
  31. data/ext/libsass/{backtrace.hpp → src/backtrace.hpp} +9 -10
  32. data/ext/libsass/{base64vlq.cpp → src/base64vlq.cpp} +2 -2
  33. data/ext/libsass/{base64vlq.hpp → src/base64vlq.hpp} +1 -2
  34. data/ext/libsass/{bind.cpp → src/bind.cpp} +96 -59
  35. data/ext/libsass/{bind.hpp → src/bind.hpp} +1 -1
  36. data/ext/libsass/src/c99func.c +54 -0
  37. data/ext/libsass/{cencode.c → src/cencode.c} +5 -5
  38. data/ext/libsass/src/color_maps.cpp +643 -0
  39. data/ext/libsass/src/color_maps.hpp +333 -0
  40. data/ext/libsass/{constants.cpp → src/constants.cpp} +10 -1
  41. data/ext/libsass/{constants.hpp → src/constants.hpp} +7 -0
  42. data/ext/libsass/{context.cpp → src/context.cpp} +152 -122
  43. data/ext/libsass/src/context.hpp +150 -0
  44. data/ext/libsass/{cssize.cpp → src/cssize.cpp} +123 -109
  45. data/ext/libsass/{cssize.hpp → src/cssize.hpp} +9 -13
  46. data/ext/libsass/{debug.hpp → src/debug.hpp} +9 -9
  47. data/ext/libsass/src/debugger.hpp +683 -0
  48. data/ext/libsass/{emitter.cpp → src/emitter.cpp} +13 -13
  49. data/ext/libsass/{emitter.hpp → src/emitter.hpp} +10 -11
  50. data/ext/libsass/src/environment.cpp +184 -0
  51. data/ext/libsass/src/environment.hpp +92 -0
  52. data/ext/libsass/src/error_handling.cpp +46 -0
  53. data/ext/libsass/src/error_handling.hpp +34 -0
  54. data/ext/libsass/src/eval.cpp +1462 -0
  55. data/ext/libsass/src/eval.hpp +107 -0
  56. data/ext/libsass/src/expand.cpp +653 -0
  57. data/ext/libsass/{expand.hpp → src/expand.hpp} +17 -16
  58. data/ext/libsass/{extend.cpp → src/extend.cpp} +198 -139
  59. data/ext/libsass/{extend.hpp → src/extend.hpp} +7 -8
  60. data/ext/libsass/{file.cpp → src/file.cpp} +103 -57
  61. data/ext/libsass/{file.hpp → src/file.hpp} +23 -14
  62. data/ext/libsass/{functions.cpp → src/functions.cpp} +642 -333
  63. data/ext/libsass/{functions.hpp → src/functions.hpp} +17 -4
  64. data/ext/libsass/{inspect.cpp → src/inspect.cpp} +147 -260
  65. data/ext/libsass/{inspect.hpp → src/inspect.hpp} +7 -7
  66. data/ext/libsass/{json.cpp → src/json.cpp} +33 -43
  67. data/ext/libsass/{json.hpp → src/json.hpp} +1 -1
  68. data/ext/libsass/{kwd_arg_macros.hpp → src/kwd_arg_macros.hpp} +0 -0
  69. data/ext/libsass/{lexer.cpp → src/lexer.cpp} +28 -0
  70. data/ext/libsass/{lexer.hpp → src/lexer.hpp} +25 -10
  71. data/ext/libsass/{listize.cpp → src/listize.cpp} +17 -13
  72. data/ext/libsass/{listize.hpp → src/listize.hpp} +0 -2
  73. data/ext/libsass/{mapping.hpp → src/mapping.hpp} +0 -0
  74. data/ext/libsass/src/memory_manager.cpp +76 -0
  75. data/ext/libsass/src/memory_manager.hpp +48 -0
  76. data/ext/libsass/{node.cpp → src/node.cpp} +89 -18
  77. data/ext/libsass/{node.hpp → src/node.hpp} +5 -6
  78. data/ext/libsass/{operation.hpp → src/operation.hpp} +18 -12
  79. data/ext/libsass/{output.cpp → src/output.cpp} +47 -55
  80. data/ext/libsass/{output.hpp → src/output.hpp} +5 -4
  81. data/ext/libsass/src/parser.cpp +2529 -0
  82. data/ext/libsass/{parser.hpp → src/parser.hpp} +84 -60
  83. data/ext/libsass/{paths.hpp → src/paths.hpp} +10 -13
  84. data/ext/libsass/{plugins.cpp → src/plugins.cpp} +14 -17
  85. data/ext/libsass/{plugins.hpp → src/plugins.hpp} +10 -11
  86. data/ext/libsass/{position.cpp → src/position.cpp} +5 -6
  87. data/ext/libsass/{position.hpp → src/position.hpp} +19 -22
  88. data/ext/libsass/{prelexer.cpp → src/prelexer.cpp} +401 -53
  89. data/ext/libsass/{prelexer.hpp → src/prelexer.hpp} +50 -10
  90. data/ext/libsass/{remove_placeholders.cpp → src/remove_placeholders.cpp} +12 -16
  91. data/ext/libsass/{remove_placeholders.hpp → src/remove_placeholders.hpp} +1 -7
  92. data/ext/libsass/{sass.cpp → src/sass.cpp} +3 -5
  93. data/ext/libsass/{sass2scss.cpp → src/sass2scss.cpp} +51 -46
  94. data/ext/libsass/{sass_context.cpp → src/sass_context.cpp} +114 -112
  95. data/ext/libsass/{sass_functions.cpp → src/sass_functions.cpp} +11 -18
  96. data/ext/libsass/{sass_interface.cpp → src/sass_interface.cpp} +44 -81
  97. data/ext/libsass/{sass_util.cpp → src/sass_util.cpp} +26 -8
  98. data/ext/libsass/{sass_util.hpp → src/sass_util.hpp} +14 -18
  99. data/ext/libsass/{sass_values.cpp → src/sass_values.cpp} +91 -20
  100. data/ext/libsass/{source_map.cpp → src/source_map.cpp} +13 -13
  101. data/ext/libsass/{source_map.hpp → src/source_map.hpp} +9 -9
  102. data/ext/libsass/{subset_map.hpp → src/subset_map.hpp} +29 -31
  103. data/ext/libsass/{support → src/support}/libsass.pc.in +0 -0
  104. data/ext/libsass/src/to_c.cpp +73 -0
  105. data/ext/libsass/src/to_c.hpp +41 -0
  106. data/ext/libsass/src/to_string.cpp +47 -0
  107. data/ext/libsass/{to_string.hpp → src/to_string.hpp} +9 -7
  108. data/ext/libsass/src/to_value.cpp +109 -0
  109. data/ext/libsass/src/to_value.hpp +50 -0
  110. data/ext/libsass/{units.cpp → src/units.cpp} +56 -51
  111. data/ext/libsass/{units.hpp → src/units.hpp} +8 -9
  112. data/ext/libsass/{utf8.h → src/utf8.h} +0 -0
  113. data/ext/libsass/{utf8 → src/utf8}/checked.h +0 -0
  114. data/ext/libsass/{utf8 → src/utf8}/core.h +12 -12
  115. data/ext/libsass/{utf8 → src/utf8}/unchecked.h +0 -0
  116. data/ext/libsass/{utf8_string.cpp → src/utf8_string.cpp} +0 -0
  117. data/ext/libsass/{utf8_string.hpp → src/utf8_string.hpp} +6 -6
  118. data/ext/libsass/{util.cpp → src/util.cpp} +144 -86
  119. data/ext/libsass/src/util.hpp +59 -0
  120. data/ext/libsass/src/values.cpp +137 -0
  121. data/ext/libsass/src/values.hpp +12 -0
  122. data/ext/libsass/test/test_node.cpp +33 -33
  123. data/ext/libsass/test/test_paths.cpp +5 -6
  124. data/ext/libsass/test/test_selector_difference.cpp +4 -5
  125. data/ext/libsass/test/test_specificity.cpp +4 -5
  126. data/ext/libsass/test/test_subset_map.cpp +91 -91
  127. data/ext/libsass/test/test_superselector.cpp +11 -11
  128. data/ext/libsass/test/test_unification.cpp +4 -4
  129. data/ext/libsass/win/libsass.targets +101 -0
  130. data/ext/libsass/win/libsass.vcxproj +45 -127
  131. data/ext/libsass/win/libsass.vcxproj.filters +303 -0
  132. data/lib/sassc/import_handler.rb +1 -1
  133. data/lib/sassc/native/native_functions_api.rb +3 -3
  134. data/lib/sassc/version.rb +1 -1
  135. data/test/custom_importer_test.rb +1 -4
  136. data/test/functions_test.rb +3 -2
  137. data/test/native_test.rb +4 -3
  138. metadata +117 -110
  139. data/ext/libsass/Makefile.am +0 -146
  140. data/ext/libsass/ast.cpp +0 -945
  141. data/ext/libsass/ast_def_macros.hpp +0 -21
  142. data/ext/libsass/ast_factory.hpp +0 -92
  143. data/ext/libsass/color_names.hpp +0 -327
  144. data/ext/libsass/context.hpp +0 -157
  145. data/ext/libsass/contextualize.cpp +0 -148
  146. data/ext/libsass/contextualize.hpp +0 -46
  147. data/ext/libsass/contextualize_eval.cpp +0 -93
  148. data/ext/libsass/contextualize_eval.hpp +0 -44
  149. data/ext/libsass/debugger.hpp +0 -558
  150. data/ext/libsass/environment.hpp +0 -163
  151. data/ext/libsass/error_handling.cpp +0 -35
  152. data/ext/libsass/error_handling.hpp +0 -32
  153. data/ext/libsass/eval.cpp +0 -1392
  154. data/ext/libsass/eval.hpp +0 -88
  155. data/ext/libsass/expand.cpp +0 -575
  156. data/ext/libsass/memory_manager.hpp +0 -57
  157. data/ext/libsass/parser.cpp +0 -2403
  158. data/ext/libsass/posix/getopt.c +0 -562
  159. data/ext/libsass/posix/getopt.h +0 -95
  160. data/ext/libsass/to_c.cpp +0 -61
  161. data/ext/libsass/to_c.hpp +0 -44
  162. data/ext/libsass/to_string.cpp +0 -34
  163. data/ext/libsass/util.hpp +0 -54
  164. data/ext/libsass/win/libsass.filters +0 -312
@@ -12,7 +12,7 @@ namespace Sass {
12
12
  class Eval;
13
13
  typedef Environment<AST_Node*> Env;
14
14
 
15
- void bind(string caller, Parameters*, Arguments*, Context&, Env*, Eval*);
15
+ void bind(std::string caller, Parameters*, Arguments*, Context&, Env*, Eval*);
16
16
  }
17
17
 
18
18
  #endif
@@ -0,0 +1,54 @@
1
+ /*
2
+ Copyright (C) 2011 Joseph A. Adams (joeyadams3.14159@gmail.com)
3
+ All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+ */
23
+
24
+ #if defined(_MSC_VER) && _MSC_VER < 1900
25
+
26
+ #include <stdio.h>
27
+ #include <stdlib.h>
28
+ #include <stdarg.h>
29
+
30
+ static int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap)
31
+ {
32
+ int count = -1;
33
+
34
+ if (size != 0)
35
+ count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
36
+ if (count == -1)
37
+ count = _vscprintf(format, ap);
38
+
39
+ return count;
40
+ }
41
+
42
+ int snprintf(char* str, size_t size, const char* format, ...)
43
+ {
44
+ int count;
45
+ va_list ap;
46
+
47
+ va_start(ap, format);
48
+ count = c99_vsnprintf(str, size, format, ap);
49
+ va_end(ap);
50
+
51
+ return count;
52
+ }
53
+
54
+ #endif
@@ -40,7 +40,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
40
40
  {
41
41
  state_in->result = result;
42
42
  state_in->step = step_A;
43
- return codechar - code_out;
43
+ return (int)(codechar - code_out);
44
44
  }
45
45
  fragment = *plainchar++;
46
46
  result = (fragment & 0x0fc) >> 2;
@@ -51,7 +51,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
51
51
  {
52
52
  state_in->result = result;
53
53
  state_in->step = step_B;
54
- return codechar - code_out;
54
+ return (int)(codechar - code_out);
55
55
  }
56
56
  fragment = *plainchar++;
57
57
  result |= (fragment & 0x0f0) >> 4;
@@ -62,7 +62,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
62
62
  {
63
63
  state_in->result = result;
64
64
  state_in->step = step_C;
65
- return codechar - code_out;
65
+ return (int)(codechar - code_out);
66
66
  }
67
67
  fragment = *plainchar++;
68
68
  result |= (fragment & 0x0c0) >> 6;
@@ -74,7 +74,7 @@ int base64_encode_block(const char* plaintext_in, int length_in, char* code_out,
74
74
  }
75
75
  }
76
76
  /* control should not reach here */
77
- return codechar - code_out;
77
+ return (int)(codechar - code_out);
78
78
  }
79
79
 
80
80
  int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
@@ -97,6 +97,6 @@ int base64_encode_blockend(char* code_out, base64_encodestate* state_in)
97
97
  }
98
98
  *codechar++ = '\n';
99
99
 
100
- return codechar - code_out;
100
+ return (int)(codechar - code_out);
101
101
  }
102
102
 
@@ -0,0 +1,643 @@
1
+ #include "ast.hpp"
2
+ #include "color_maps.hpp"
3
+
4
+ namespace Sass {
5
+
6
+ namespace ColorNames
7
+ {
8
+ const char aliceblue [] = "aliceblue";
9
+ const char antiquewhite [] = "antiquewhite";
10
+ const char cyan [] = "cyan";
11
+ const char aqua [] = "aqua";
12
+ const char aquamarine [] = "aquamarine";
13
+ const char azure [] = "azure";
14
+ const char beige [] = "beige";
15
+ const char bisque [] = "bisque";
16
+ const char black [] = "black";
17
+ const char blanchedalmond [] = "blanchedalmond";
18
+ const char blue [] = "blue";
19
+ const char blueviolet [] = "blueviolet";
20
+ const char brown [] = "brown";
21
+ const char burlywood [] = "burlywood";
22
+ const char cadetblue [] = "cadetblue";
23
+ const char chartreuse [] = "chartreuse";
24
+ const char chocolate [] = "chocolate";
25
+ const char coral [] = "coral";
26
+ const char cornflowerblue [] = "cornflowerblue";
27
+ const char cornsilk [] = "cornsilk";
28
+ const char crimson [] = "crimson";
29
+ const char darkblue [] = "darkblue";
30
+ const char darkcyan [] = "darkcyan";
31
+ const char darkgoldenrod [] = "darkgoldenrod";
32
+ const char darkgray [] = "darkgray";
33
+ const char darkgrey [] = "darkgrey";
34
+ const char darkgreen [] = "darkgreen";
35
+ const char darkkhaki [] = "darkkhaki";
36
+ const char darkmagenta [] = "darkmagenta";
37
+ const char darkolivegreen [] = "darkolivegreen";
38
+ const char darkorange [] = "darkorange";
39
+ const char darkorchid [] = "darkorchid";
40
+ const char darkred [] = "darkred";
41
+ const char darksalmon [] = "darksalmon";
42
+ const char darkseagreen [] = "darkseagreen";
43
+ const char darkslateblue [] = "darkslateblue";
44
+ const char darkslategray [] = "darkslategray";
45
+ const char darkslategrey [] = "darkslategrey";
46
+ const char darkturquoise [] = "darkturquoise";
47
+ const char darkviolet [] = "darkviolet";
48
+ const char deeppink [] = "deeppink";
49
+ const char deepskyblue [] = "deepskyblue";
50
+ const char dimgray [] = "dimgray";
51
+ const char dimgrey [] = "dimgrey";
52
+ const char dodgerblue [] = "dodgerblue";
53
+ const char firebrick [] = "firebrick";
54
+ const char floralwhite [] = "floralwhite";
55
+ const char forestgreen [] = "forestgreen";
56
+ const char magenta [] = "magenta";
57
+ const char fuchsia [] = "fuchsia";
58
+ const char gainsboro [] = "gainsboro";
59
+ const char ghostwhite [] = "ghostwhite";
60
+ const char gold [] = "gold";
61
+ const char goldenrod [] = "goldenrod";
62
+ const char gray [] = "gray";
63
+ const char grey [] = "grey";
64
+ const char green [] = "green";
65
+ const char greenyellow [] = "greenyellow";
66
+ const char honeydew [] = "honeydew";
67
+ const char hotpink [] = "hotpink";
68
+ const char indianred [] = "indianred";
69
+ const char indigo [] = "indigo";
70
+ const char ivory [] = "ivory";
71
+ const char khaki [] = "khaki";
72
+ const char lavender [] = "lavender";
73
+ const char lavenderblush [] = "lavenderblush";
74
+ const char lawngreen [] = "lawngreen";
75
+ const char lemonchiffon [] = "lemonchiffon";
76
+ const char lightblue [] = "lightblue";
77
+ const char lightcoral [] = "lightcoral";
78
+ const char lightcyan [] = "lightcyan";
79
+ const char lightgoldenrodyellow [] = "lightgoldenrodyellow";
80
+ const char lightgray [] = "lightgray";
81
+ const char lightgrey [] = "lightgrey";
82
+ const char lightgreen [] = "lightgreen";
83
+ const char lightpink [] = "lightpink";
84
+ const char lightsalmon [] = "lightsalmon";
85
+ const char lightseagreen [] = "lightseagreen";
86
+ const char lightskyblue [] = "lightskyblue";
87
+ const char lightslategray [] = "lightslategray";
88
+ const char lightslategrey [] = "lightslategrey";
89
+ const char lightsteelblue [] = "lightsteelblue";
90
+ const char lightyellow [] = "lightyellow";
91
+ const char lime [] = "lime";
92
+ const char limegreen [] = "limegreen";
93
+ const char linen [] = "linen";
94
+ const char maroon [] = "maroon";
95
+ const char mediumaquamarine [] = "mediumaquamarine";
96
+ const char mediumblue [] = "mediumblue";
97
+ const char mediumorchid [] = "mediumorchid";
98
+ const char mediumpurple [] = "mediumpurple";
99
+ const char mediumseagreen [] = "mediumseagreen";
100
+ const char mediumslateblue [] = "mediumslateblue";
101
+ const char mediumspringgreen [] = "mediumspringgreen";
102
+ const char mediumturquoise [] = "mediumturquoise";
103
+ const char mediumvioletred [] = "mediumvioletred";
104
+ const char midnightblue [] = "midnightblue";
105
+ const char mintcream [] = "mintcream";
106
+ const char mistyrose [] = "mistyrose";
107
+ const char moccasin [] = "moccasin";
108
+ const char navajowhite [] = "navajowhite";
109
+ const char navy [] = "navy";
110
+ const char oldlace [] = "oldlace";
111
+ const char olive [] = "olive";
112
+ const char olivedrab [] = "olivedrab";
113
+ const char orange [] = "orange";
114
+ const char orangered [] = "orangered";
115
+ const char orchid [] = "orchid";
116
+ const char palegoldenrod [] = "palegoldenrod";
117
+ const char palegreen [] = "palegreen";
118
+ const char paleturquoise [] = "paleturquoise";
119
+ const char palevioletred [] = "palevioletred";
120
+ const char papayawhip [] = "papayawhip";
121
+ const char peachpuff [] = "peachpuff";
122
+ const char peru [] = "peru";
123
+ const char pink [] = "pink";
124
+ const char plum [] = "plum";
125
+ const char powderblue [] = "powderblue";
126
+ const char purple [] = "purple";
127
+ const char red [] = "red";
128
+ const char rosybrown [] = "rosybrown";
129
+ const char royalblue [] = "royalblue";
130
+ const char saddlebrown [] = "saddlebrown";
131
+ const char salmon [] = "salmon";
132
+ const char sandybrown [] = "sandybrown";
133
+ const char seagreen [] = "seagreen";
134
+ const char seashell [] = "seashell";
135
+ const char sienna [] = "sienna";
136
+ const char silver [] = "silver";
137
+ const char skyblue [] = "skyblue";
138
+ const char slateblue [] = "slateblue";
139
+ const char slategray [] = "slategray";
140
+ const char slategrey [] = "slategrey";
141
+ const char snow [] = "snow";
142
+ const char springgreen [] = "springgreen";
143
+ const char steelblue [] = "steelblue";
144
+ const char tan [] = "tan";
145
+ const char teal [] = "teal";
146
+ const char thistle [] = "thistle";
147
+ const char tomato [] = "tomato";
148
+ const char turquoise [] = "turquoise";
149
+ const char violet [] = "violet";
150
+ const char wheat [] = "wheat";
151
+ const char white [] = "white";
152
+ const char whitesmoke [] = "whitesmoke";
153
+ const char yellow [] = "yellow";
154
+ const char yellowgreen [] = "yellowgreen";
155
+ const char rebeccapurple [] = "rebeccapurple";
156
+ const char transparent [] = "transparent";
157
+ }
158
+
159
+ namespace Colors {
160
+ const ParserState color_table("[COLOR TABLE]");
161
+ const Color aliceblue(color_table, 240, 248, 255, 1);
162
+ const Color antiquewhite(color_table, 250, 235, 215, 1);
163
+ const Color cyan(color_table, 0, 255, 255, 1);
164
+ const Color aqua(color_table, 0, 255, 255, 1);
165
+ const Color aquamarine(color_table, 127, 255, 212, 1);
166
+ const Color azure(color_table, 240, 255, 255, 1);
167
+ const Color beige(color_table, 245, 245, 220, 1);
168
+ const Color bisque(color_table, 255, 228, 196, 1);
169
+ const Color black(color_table, 0, 0, 0, 1);
170
+ const Color blanchedalmond(color_table, 255, 235, 205, 1);
171
+ const Color blue(color_table, 0, 0, 255, 1);
172
+ const Color blueviolet(color_table, 138, 43, 226, 1);
173
+ const Color brown(color_table, 165, 42, 42, 1);
174
+ const Color burlywood(color_table, 222, 184, 135, 1);
175
+ const Color cadetblue(color_table, 95, 158, 160, 1);
176
+ const Color chartreuse(color_table, 127, 255, 0, 1);
177
+ const Color chocolate(color_table, 210, 105, 30, 1);
178
+ const Color coral(color_table, 255, 127, 80, 1);
179
+ const Color cornflowerblue(color_table, 100, 149, 237, 1);
180
+ const Color cornsilk(color_table, 255, 248, 220, 1);
181
+ const Color crimson(color_table, 220, 20, 60, 1);
182
+ const Color darkblue(color_table, 0, 0, 139, 1);
183
+ const Color darkcyan(color_table, 0, 139, 139, 1);
184
+ const Color darkgoldenrod(color_table, 184, 134, 11, 1);
185
+ const Color darkgray(color_table, 169, 169, 169, 1);
186
+ const Color darkgrey(color_table, 169, 169, 169, 1);
187
+ const Color darkgreen(color_table, 0, 100, 0, 1);
188
+ const Color darkkhaki(color_table, 189, 183, 107, 1);
189
+ const Color darkmagenta(color_table, 139, 0, 139, 1);
190
+ const Color darkolivegreen(color_table, 85, 107, 47, 1);
191
+ const Color darkorange(color_table, 255, 140, 0, 1);
192
+ const Color darkorchid(color_table, 153, 50, 204, 1);
193
+ const Color darkred(color_table, 139, 0, 0, 1);
194
+ const Color darksalmon(color_table, 233, 150, 122, 1);
195
+ const Color darkseagreen(color_table, 143, 188, 143, 1);
196
+ const Color darkslateblue(color_table, 72, 61, 139, 1);
197
+ const Color darkslategray(color_table, 47, 79, 79, 1);
198
+ const Color darkslategrey(color_table, 47, 79, 79, 1);
199
+ const Color darkturquoise(color_table, 0, 206, 209, 1);
200
+ const Color darkviolet(color_table, 148, 0, 211, 1);
201
+ const Color deeppink(color_table, 255, 20, 147, 1);
202
+ const Color deepskyblue(color_table, 0, 191, 255, 1);
203
+ const Color dimgray(color_table, 105, 105, 105, 1);
204
+ const Color dimgrey(color_table, 105, 105, 105, 1);
205
+ const Color dodgerblue(color_table, 30, 144, 255, 1);
206
+ const Color firebrick(color_table, 178, 34, 34, 1);
207
+ const Color floralwhite(color_table, 255, 250, 240, 1);
208
+ const Color forestgreen(color_table, 34, 139, 34, 1);
209
+ const Color magenta(color_table, 255, 0, 255, 1);
210
+ const Color fuchsia(color_table, 255, 0, 255, 1);
211
+ const Color gainsboro(color_table, 220, 220, 220, 1);
212
+ const Color ghostwhite(color_table, 248, 248, 255, 1);
213
+ const Color gold(color_table, 255, 215, 0, 1);
214
+ const Color goldenrod(color_table, 218, 165, 32, 1);
215
+ const Color gray(color_table, 128, 128, 128, 1);
216
+ const Color grey(color_table, 128, 128, 128, 1);
217
+ const Color green(color_table, 0, 128, 0, 1);
218
+ const Color greenyellow(color_table, 173, 255, 47, 1);
219
+ const Color honeydew(color_table, 240, 255, 240, 1);
220
+ const Color hotpink(color_table, 255, 105, 180, 1);
221
+ const Color indianred(color_table, 205, 92, 92, 1);
222
+ const Color indigo(color_table, 75, 0, 130, 1);
223
+ const Color ivory(color_table, 255, 255, 240, 1);
224
+ const Color khaki(color_table, 240, 230, 140, 1);
225
+ const Color lavender(color_table, 230, 230, 250, 1);
226
+ const Color lavenderblush(color_table, 255, 240, 245, 1);
227
+ const Color lawngreen(color_table, 124, 252, 0, 1);
228
+ const Color lemonchiffon(color_table, 255, 250, 205, 1);
229
+ const Color lightblue(color_table, 173, 216, 230, 1);
230
+ const Color lightcoral(color_table, 240, 128, 128, 1);
231
+ const Color lightcyan(color_table, 224, 255, 255, 1);
232
+ const Color lightgoldenrodyellow(color_table, 250, 250, 210, 1);
233
+ const Color lightgray(color_table, 211, 211, 211, 1);
234
+ const Color lightgrey(color_table, 211, 211, 211, 1);
235
+ const Color lightgreen(color_table, 144, 238, 144, 1);
236
+ const Color lightpink(color_table, 255, 182, 193, 1);
237
+ const Color lightsalmon(color_table, 255, 160, 122, 1);
238
+ const Color lightseagreen(color_table, 32, 178, 170, 1);
239
+ const Color lightskyblue(color_table, 135, 206, 250, 1);
240
+ const Color lightslategray(color_table, 119, 136, 153, 1);
241
+ const Color lightslategrey(color_table, 119, 136, 153, 1);
242
+ const Color lightsteelblue(color_table, 176, 196, 222, 1);
243
+ const Color lightyellow(color_table, 255, 255, 224, 1);
244
+ const Color lime(color_table, 0, 255, 0, 1);
245
+ const Color limegreen(color_table, 50, 205, 50, 1);
246
+ const Color linen(color_table, 250, 240, 230, 1);
247
+ const Color maroon(color_table, 128, 0, 0, 1);
248
+ const Color mediumaquamarine(color_table, 102, 205, 170, 1);
249
+ const Color mediumblue(color_table, 0, 0, 205, 1);
250
+ const Color mediumorchid(color_table, 186, 85, 211, 1);
251
+ const Color mediumpurple(color_table, 147, 112, 219, 1);
252
+ const Color mediumseagreen(color_table, 60, 179, 113, 1);
253
+ const Color mediumslateblue(color_table, 123, 104, 238, 1);
254
+ const Color mediumspringgreen(color_table, 0, 250, 154, 1);
255
+ const Color mediumturquoise(color_table, 72, 209, 204, 1);
256
+ const Color mediumvioletred(color_table, 199, 21, 133, 1);
257
+ const Color midnightblue(color_table, 25, 25, 112, 1);
258
+ const Color mintcream(color_table, 245, 255, 250, 1);
259
+ const Color mistyrose(color_table, 255, 228, 225, 1);
260
+ const Color moccasin(color_table, 255, 228, 181, 1);
261
+ const Color navajowhite(color_table, 255, 222, 173, 1);
262
+ const Color navy(color_table, 0, 0, 128, 1);
263
+ const Color oldlace(color_table, 253, 245, 230, 1);
264
+ const Color olive(color_table, 128, 128, 0, 1);
265
+ const Color olivedrab(color_table, 107, 142, 35, 1);
266
+ const Color orange(color_table, 255, 165, 0, 1);
267
+ const Color orangered(color_table, 255, 69, 0, 1);
268
+ const Color orchid(color_table, 218, 112, 214, 1);
269
+ const Color palegoldenrod(color_table, 238, 232, 170, 1);
270
+ const Color palegreen(color_table, 152, 251, 152, 1);
271
+ const Color paleturquoise(color_table, 175, 238, 238, 1);
272
+ const Color palevioletred(color_table, 219, 112, 147, 1);
273
+ const Color papayawhip(color_table, 255, 239, 213, 1);
274
+ const Color peachpuff(color_table, 255, 218, 185, 1);
275
+ const Color peru(color_table, 205, 133, 63, 1);
276
+ const Color pink(color_table, 255, 192, 203, 1);
277
+ const Color plum(color_table, 221, 160, 221, 1);
278
+ const Color powderblue(color_table, 176, 224, 230, 1);
279
+ const Color purple(color_table, 128, 0, 128, 1);
280
+ const Color red(color_table, 255, 0, 0, 1);
281
+ const Color rosybrown(color_table, 188, 143, 143, 1);
282
+ const Color royalblue(color_table, 65, 105, 225, 1);
283
+ const Color saddlebrown(color_table, 139, 69, 19, 1);
284
+ const Color salmon(color_table, 250, 128, 114, 1);
285
+ const Color sandybrown(color_table, 244, 164, 96, 1);
286
+ const Color seagreen(color_table, 46, 139, 87, 1);
287
+ const Color seashell(color_table, 255, 245, 238, 1);
288
+ const Color sienna(color_table, 160, 82, 45, 1);
289
+ const Color silver(color_table, 192, 192, 192, 1);
290
+ const Color skyblue(color_table, 135, 206, 235, 1);
291
+ const Color slateblue(color_table, 106, 90, 205, 1);
292
+ const Color slategray(color_table, 112, 128, 144, 1);
293
+ const Color slategrey(color_table, 112, 128, 144, 1);
294
+ const Color snow(color_table, 255, 250, 250, 1);
295
+ const Color springgreen(color_table, 0, 255, 127, 1);
296
+ const Color steelblue(color_table, 70, 130, 180, 1);
297
+ const Color tan(color_table, 210, 180, 140, 1);
298
+ const Color teal(color_table, 0, 128, 128, 1);
299
+ const Color thistle(color_table, 216, 191, 216, 1);
300
+ const Color tomato(color_table, 255, 99, 71, 1);
301
+ const Color turquoise(color_table, 64, 224, 208, 1);
302
+ const Color violet(color_table, 238, 130, 238, 1);
303
+ const Color wheat(color_table, 245, 222, 179, 1);
304
+ const Color white(color_table, 255, 255, 255, 1);
305
+ const Color whitesmoke(color_table, 245, 245, 245, 1);
306
+ const Color yellow(color_table, 255, 255, 0, 1);
307
+ const Color yellowgreen(color_table, 154, 205, 50, 1);
308
+ const Color rebeccapurple(color_table, 102, 51, 153, 1);
309
+ const Color transparent(color_table, 0, 0, 0, 0);
310
+ }
311
+
312
+ const std::map<const int, const char*> colors_to_names {
313
+ { 240 * 0x10000 + 248 * 0x100 + 255, ColorNames::aliceblue },
314
+ { 250 * 0x10000 + 235 * 0x100 + 215, ColorNames::antiquewhite },
315
+ { 0 * 0x10000 + 255 * 0x100 + 255, ColorNames::cyan },
316
+ { 127 * 0x10000 + 255 * 0x100 + 212, ColorNames::aquamarine },
317
+ { 240 * 0x10000 + 255 * 0x100 + 255, ColorNames::azure },
318
+ { 245 * 0x10000 + 245 * 0x100 + 220, ColorNames::beige },
319
+ { 255 * 0x10000 + 228 * 0x100 + 196, ColorNames::bisque },
320
+ { 0 * 0x10000 + 0 * 0x100 + 0, ColorNames::black },
321
+ { 255 * 0x10000 + 235 * 0x100 + 205, ColorNames::blanchedalmond },
322
+ { 0 * 0x10000 + 0 * 0x100 + 255, ColorNames::blue },
323
+ { 138 * 0x10000 + 43 * 0x100 + 226, ColorNames::blueviolet },
324
+ { 165 * 0x10000 + 42 * 0x100 + 42, ColorNames::brown },
325
+ { 222 * 0x10000 + 184 * 0x100 + 135, ColorNames::burlywood },
326
+ { 95 * 0x10000 + 158 * 0x100 + 160, ColorNames::cadetblue },
327
+ { 127 * 0x10000 + 255 * 0x100 + 0, ColorNames::chartreuse },
328
+ { 210 * 0x10000 + 105 * 0x100 + 30, ColorNames::chocolate },
329
+ { 255 * 0x10000 + 127 * 0x100 + 80, ColorNames::coral },
330
+ { 100 * 0x10000 + 149 * 0x100 + 237, ColorNames::cornflowerblue },
331
+ { 255 * 0x10000 + 248 * 0x100 + 220, ColorNames::cornsilk },
332
+ { 220 * 0x10000 + 20 * 0x100 + 60, ColorNames::crimson },
333
+ { 0 * 0x10000 + 0 * 0x100 + 139, ColorNames::darkblue },
334
+ { 0 * 0x10000 + 139 * 0x100 + 139, ColorNames::darkcyan },
335
+ { 184 * 0x10000 + 134 * 0x100 + 11, ColorNames::darkgoldenrod },
336
+ { 169 * 0x10000 + 169 * 0x100 + 169, ColorNames::darkgray },
337
+ { 0 * 0x10000 + 100 * 0x100 + 0, ColorNames::darkgreen },
338
+ { 189 * 0x10000 + 183 * 0x100 + 107, ColorNames::darkkhaki },
339
+ { 139 * 0x10000 + 0 * 0x100 + 139, ColorNames::darkmagenta },
340
+ { 85 * 0x10000 + 107 * 0x100 + 47, ColorNames::darkolivegreen },
341
+ { 255 * 0x10000 + 140 * 0x100 + 0, ColorNames::darkorange },
342
+ { 153 * 0x10000 + 50 * 0x100 + 204, ColorNames::darkorchid },
343
+ { 139 * 0x10000 + 0 * 0x100 + 0, ColorNames::darkred },
344
+ { 233 * 0x10000 + 150 * 0x100 + 122, ColorNames::darksalmon },
345
+ { 143 * 0x10000 + 188 * 0x100 + 143, ColorNames::darkseagreen },
346
+ { 72 * 0x10000 + 61 * 0x100 + 139, ColorNames::darkslateblue },
347
+ { 47 * 0x10000 + 79 * 0x100 + 79, ColorNames::darkslategray },
348
+ { 0 * 0x10000 + 206 * 0x100 + 209, ColorNames::darkturquoise },
349
+ { 148 * 0x10000 + 0 * 0x100 + 211, ColorNames::darkviolet },
350
+ { 255 * 0x10000 + 20 * 0x100 + 147, ColorNames::deeppink },
351
+ { 0 * 0x10000 + 191 * 0x100 + 255, ColorNames::deepskyblue },
352
+ { 105 * 0x10000 + 105 * 0x100 + 105, ColorNames::dimgray },
353
+ { 30 * 0x10000 + 144 * 0x100 + 255, ColorNames::dodgerblue },
354
+ { 178 * 0x10000 + 34 * 0x100 + 34, ColorNames::firebrick },
355
+ { 255 * 0x10000 + 250 * 0x100 + 240, ColorNames::floralwhite },
356
+ { 34 * 0x10000 + 139 * 0x100 + 34, ColorNames::forestgreen },
357
+ { 255 * 0x10000 + 0 * 0x100 + 255, ColorNames::magenta },
358
+ { 220 * 0x10000 + 220 * 0x100 + 220, ColorNames::gainsboro },
359
+ { 248 * 0x10000 + 248 * 0x100 + 255, ColorNames::ghostwhite },
360
+ { 255 * 0x10000 + 215 * 0x100 + 0, ColorNames::gold },
361
+ { 218 * 0x10000 + 165 * 0x100 + 32, ColorNames::goldenrod },
362
+ { 128 * 0x10000 + 128 * 0x100 + 128, ColorNames::gray },
363
+ { 0 * 0x10000 + 128 * 0x100 + 0, ColorNames::green },
364
+ { 173 * 0x10000 + 255 * 0x100 + 47, ColorNames::greenyellow },
365
+ { 240 * 0x10000 + 255 * 0x100 + 240, ColorNames::honeydew },
366
+ { 255 * 0x10000 + 105 * 0x100 + 180, ColorNames::hotpink },
367
+ { 205 * 0x10000 + 92 * 0x100 + 92, ColorNames::indianred },
368
+ { 75 * 0x10000 + 0 * 0x100 + 130, ColorNames::indigo },
369
+ { 255 * 0x10000 + 255 * 0x100 + 240, ColorNames::ivory },
370
+ { 240 * 0x10000 + 230 * 0x100 + 140, ColorNames::khaki },
371
+ { 230 * 0x10000 + 230 * 0x100 + 250, ColorNames::lavender },
372
+ { 255 * 0x10000 + 240 * 0x100 + 245, ColorNames::lavenderblush },
373
+ { 124 * 0x10000 + 252 * 0x100 + 0, ColorNames::lawngreen },
374
+ { 255 * 0x10000 + 250 * 0x100 + 205, ColorNames::lemonchiffon },
375
+ { 173 * 0x10000 + 216 * 0x100 + 230, ColorNames::lightblue },
376
+ { 240 * 0x10000 + 128 * 0x100 + 128, ColorNames::lightcoral },
377
+ { 224 * 0x10000 + 255 * 0x100 + 255, ColorNames::lightcyan },
378
+ { 250 * 0x10000 + 250 * 0x100 + 210, ColorNames::lightgoldenrodyellow },
379
+ { 211 * 0x10000 + 211 * 0x100 + 211, ColorNames::lightgray },
380
+ { 144 * 0x10000 + 238 * 0x100 + 144, ColorNames::lightgreen },
381
+ { 255 * 0x10000 + 182 * 0x100 + 193, ColorNames::lightpink },
382
+ { 255 * 0x10000 + 160 * 0x100 + 122, ColorNames::lightsalmon },
383
+ { 32 * 0x10000 + 178 * 0x100 + 170, ColorNames::lightseagreen },
384
+ { 135 * 0x10000 + 206 * 0x100 + 250, ColorNames::lightskyblue },
385
+ { 119 * 0x10000 + 136 * 0x100 + 153, ColorNames::lightslategray },
386
+ { 176 * 0x10000 + 196 * 0x100 + 222, ColorNames::lightsteelblue },
387
+ { 255 * 0x10000 + 255 * 0x100 + 224, ColorNames::lightyellow },
388
+ { 0 * 0x10000 + 255 * 0x100 + 0, ColorNames::lime },
389
+ { 50 * 0x10000 + 205 * 0x100 + 50, ColorNames::limegreen },
390
+ { 250 * 0x10000 + 240 * 0x100 + 230, ColorNames::linen },
391
+ { 128 * 0x10000 + 0 * 0x100 + 0, ColorNames::maroon },
392
+ { 102 * 0x10000 + 205 * 0x100 + 170, ColorNames::mediumaquamarine },
393
+ { 0 * 0x10000 + 0 * 0x100 + 205, ColorNames::mediumblue },
394
+ { 186 * 0x10000 + 85 * 0x100 + 211, ColorNames::mediumorchid },
395
+ { 147 * 0x10000 + 112 * 0x100 + 219, ColorNames::mediumpurple },
396
+ { 60 * 0x10000 + 179 * 0x100 + 113, ColorNames::mediumseagreen },
397
+ { 123 * 0x10000 + 104 * 0x100 + 238, ColorNames::mediumslateblue },
398
+ { 0 * 0x10000 + 250 * 0x100 + 154, ColorNames::mediumspringgreen },
399
+ { 72 * 0x10000 + 209 * 0x100 + 204, ColorNames::mediumturquoise },
400
+ { 199 * 0x10000 + 21 * 0x100 + 133, ColorNames::mediumvioletred },
401
+ { 25 * 0x10000 + 25 * 0x100 + 112, ColorNames::midnightblue },
402
+ { 245 * 0x10000 + 255 * 0x100 + 250, ColorNames::mintcream },
403
+ { 255 * 0x10000 + 228 * 0x100 + 225, ColorNames::mistyrose },
404
+ { 255 * 0x10000 + 228 * 0x100 + 181, ColorNames::moccasin },
405
+ { 255 * 0x10000 + 222 * 0x100 + 173, ColorNames::navajowhite },
406
+ { 0 * 0x10000 + 0 * 0x100 + 128, ColorNames::navy },
407
+ { 253 * 0x10000 + 245 * 0x100 + 230, ColorNames::oldlace },
408
+ { 128 * 0x10000 + 128 * 0x100 + 0, ColorNames::olive },
409
+ { 107 * 0x10000 + 142 * 0x100 + 35, ColorNames::olivedrab },
410
+ { 255 * 0x10000 + 165 * 0x100 + 0, ColorNames::orange },
411
+ { 255 * 0x10000 + 69 * 0x100 + 0, ColorNames::orangered },
412
+ { 218 * 0x10000 + 112 * 0x100 + 214, ColorNames::orchid },
413
+ { 238 * 0x10000 + 232 * 0x100 + 170, ColorNames::palegoldenrod },
414
+ { 152 * 0x10000 + 251 * 0x100 + 152, ColorNames::palegreen },
415
+ { 175 * 0x10000 + 238 * 0x100 + 238, ColorNames::paleturquoise },
416
+ { 219 * 0x10000 + 112 * 0x100 + 147, ColorNames::palevioletred },
417
+ { 255 * 0x10000 + 239 * 0x100 + 213, ColorNames::papayawhip },
418
+ { 255 * 0x10000 + 218 * 0x100 + 185, ColorNames::peachpuff },
419
+ { 205 * 0x10000 + 133 * 0x100 + 63, ColorNames::peru },
420
+ { 255 * 0x10000 + 192 * 0x100 + 203, ColorNames::pink },
421
+ { 221 * 0x10000 + 160 * 0x100 + 221, ColorNames::plum },
422
+ { 176 * 0x10000 + 224 * 0x100 + 230, ColorNames::powderblue },
423
+ { 128 * 0x10000 + 0 * 0x100 + 128, ColorNames::purple },
424
+ { 255 * 0x10000 + 0 * 0x100 + 0, ColorNames::red },
425
+ { 188 * 0x10000 + 143 * 0x100 + 143, ColorNames::rosybrown },
426
+ { 65 * 0x10000 + 105 * 0x100 + 225, ColorNames::royalblue },
427
+ { 139 * 0x10000 + 69 * 0x100 + 19, ColorNames::saddlebrown },
428
+ { 250 * 0x10000 + 128 * 0x100 + 114, ColorNames::salmon },
429
+ { 244 * 0x10000 + 164 * 0x100 + 96, ColorNames::sandybrown },
430
+ { 46 * 0x10000 + 139 * 0x100 + 87, ColorNames::seagreen },
431
+ { 255 * 0x10000 + 245 * 0x100 + 238, ColorNames::seashell },
432
+ { 160 * 0x10000 + 82 * 0x100 + 45, ColorNames::sienna },
433
+ { 192 * 0x10000 + 192 * 0x100 + 192, ColorNames::silver },
434
+ { 135 * 0x10000 + 206 * 0x100 + 235, ColorNames::skyblue },
435
+ { 106 * 0x10000 + 90 * 0x100 + 205, ColorNames::slateblue },
436
+ { 112 * 0x10000 + 128 * 0x100 + 144, ColorNames::slategray },
437
+ { 255 * 0x10000 + 250 * 0x100 + 250, ColorNames::snow },
438
+ { 0 * 0x10000 + 255 * 0x100 + 127, ColorNames::springgreen },
439
+ { 70 * 0x10000 + 130 * 0x100 + 180, ColorNames::steelblue },
440
+ { 210 * 0x10000 + 180 * 0x100 + 140, ColorNames::tan },
441
+ { 0 * 0x10000 + 128 * 0x100 + 128, ColorNames::teal },
442
+ { 216 * 0x10000 + 191 * 0x100 + 216, ColorNames::thistle },
443
+ { 255 * 0x10000 + 99 * 0x100 + 71, ColorNames::tomato },
444
+ { 64 * 0x10000 + 224 * 0x100 + 208, ColorNames::turquoise },
445
+ { 238 * 0x10000 + 130 * 0x100 + 238, ColorNames::violet },
446
+ { 245 * 0x10000 + 222 * 0x100 + 179, ColorNames::wheat },
447
+ { 255 * 0x10000 + 255 * 0x100 + 255, ColorNames::white },
448
+ { 245 * 0x10000 + 245 * 0x100 + 245, ColorNames::whitesmoke },
449
+ { 255 * 0x10000 + 255 * 0x100 + 0, ColorNames::yellow },
450
+ { 154 * 0x10000 + 205 * 0x100 + 50, ColorNames::yellowgreen },
451
+ { 102 * 0x10000 + 51 * 0x100 + 153, ColorNames::rebeccapurple }
452
+ };
453
+
454
+ const std::map<const char*, const Color*, map_cmp_str> names_to_colors
455
+ {
456
+ { ColorNames::aliceblue, &Colors::aliceblue },
457
+ { ColorNames::antiquewhite, &Colors::antiquewhite },
458
+ { ColorNames::cyan, &Colors::cyan },
459
+ { ColorNames::aqua, &Colors::aqua },
460
+ { ColorNames::aquamarine, &Colors::aquamarine },
461
+ { ColorNames::azure, &Colors::azure },
462
+ { ColorNames::beige, &Colors::beige },
463
+ { ColorNames::bisque, &Colors::bisque },
464
+ { ColorNames::black, &Colors::black },
465
+ { ColorNames::blanchedalmond, &Colors::blanchedalmond },
466
+ { ColorNames::blue, &Colors::blue },
467
+ { ColorNames::blueviolet, &Colors::blueviolet },
468
+ { ColorNames::brown, &Colors::brown },
469
+ { ColorNames::burlywood, &Colors::burlywood },
470
+ { ColorNames::cadetblue, &Colors::cadetblue },
471
+ { ColorNames::chartreuse, &Colors::chartreuse },
472
+ { ColorNames::chocolate, &Colors::chocolate },
473
+ { ColorNames::coral, &Colors::coral },
474
+ { ColorNames::cornflowerblue, &Colors::cornflowerblue },
475
+ { ColorNames::cornsilk, &Colors::cornsilk },
476
+ { ColorNames::crimson, &Colors::crimson },
477
+ { ColorNames::darkblue, &Colors::darkblue },
478
+ { ColorNames::darkcyan, &Colors::darkcyan },
479
+ { ColorNames::darkgoldenrod, &Colors::darkgoldenrod },
480
+ { ColorNames::darkgray, &Colors::darkgray },
481
+ { ColorNames::darkgrey, &Colors::darkgrey },
482
+ { ColorNames::darkgreen, &Colors::darkgreen },
483
+ { ColorNames::darkkhaki, &Colors::darkkhaki },
484
+ { ColorNames::darkmagenta, &Colors::darkmagenta },
485
+ { ColorNames::darkolivegreen, &Colors::darkolivegreen },
486
+ { ColorNames::darkorange, &Colors::darkorange },
487
+ { ColorNames::darkorchid, &Colors::darkorchid },
488
+ { ColorNames::darkred, &Colors::darkred },
489
+ { ColorNames::darksalmon, &Colors::darksalmon },
490
+ { ColorNames::darkseagreen, &Colors::darkseagreen },
491
+ { ColorNames::darkslateblue, &Colors::darkslateblue },
492
+ { ColorNames::darkslategray, &Colors::darkslategray },
493
+ { ColorNames::darkslategrey, &Colors::darkslategrey },
494
+ { ColorNames::darkturquoise, &Colors::darkturquoise },
495
+ { ColorNames::darkviolet, &Colors::darkviolet },
496
+ { ColorNames::deeppink, &Colors::deeppink },
497
+ { ColorNames::deepskyblue, &Colors::deepskyblue },
498
+ { ColorNames::dimgray, &Colors::dimgray },
499
+ { ColorNames::dimgrey, &Colors::dimgrey },
500
+ { ColorNames::dodgerblue, &Colors::dodgerblue },
501
+ { ColorNames::firebrick, &Colors::firebrick },
502
+ { ColorNames::floralwhite, &Colors::floralwhite },
503
+ { ColorNames::forestgreen, &Colors::forestgreen },
504
+ { ColorNames::magenta, &Colors::magenta },
505
+ { ColorNames::fuchsia, &Colors::fuchsia },
506
+ { ColorNames::gainsboro, &Colors::gainsboro },
507
+ { ColorNames::ghostwhite, &Colors::ghostwhite },
508
+ { ColorNames::gold, &Colors::gold },
509
+ { ColorNames::goldenrod, &Colors::goldenrod },
510
+ { ColorNames::gray, &Colors::gray },
511
+ { ColorNames::grey, &Colors::grey },
512
+ { ColorNames::green, &Colors::green },
513
+ { ColorNames::greenyellow, &Colors::greenyellow },
514
+ { ColorNames::honeydew, &Colors::honeydew },
515
+ { ColorNames::hotpink, &Colors::hotpink },
516
+ { ColorNames::indianred, &Colors::indianred },
517
+ { ColorNames::indigo, &Colors::indigo },
518
+ { ColorNames::ivory, &Colors::ivory },
519
+ { ColorNames::khaki, &Colors::khaki },
520
+ { ColorNames::lavender, &Colors::lavender },
521
+ { ColorNames::lavenderblush, &Colors::lavenderblush },
522
+ { ColorNames::lawngreen, &Colors::lawngreen },
523
+ { ColorNames::lemonchiffon, &Colors::lemonchiffon },
524
+ { ColorNames::lightblue, &Colors::lightblue },
525
+ { ColorNames::lightcoral, &Colors::lightcoral },
526
+ { ColorNames::lightcyan, &Colors::lightcyan },
527
+ { ColorNames::lightgoldenrodyellow, &Colors::lightgoldenrodyellow },
528
+ { ColorNames::lightgray, &Colors::lightgray },
529
+ { ColorNames::lightgrey, &Colors::lightgrey },
530
+ { ColorNames::lightgreen, &Colors::lightgreen },
531
+ { ColorNames::lightpink, &Colors::lightpink },
532
+ { ColorNames::lightsalmon, &Colors::lightsalmon },
533
+ { ColorNames::lightseagreen, &Colors::lightseagreen },
534
+ { ColorNames::lightskyblue, &Colors::lightskyblue },
535
+ { ColorNames::lightslategray, &Colors::lightslategray },
536
+ { ColorNames::lightslategrey, &Colors::lightslategrey },
537
+ { ColorNames::lightsteelblue, &Colors::lightsteelblue },
538
+ { ColorNames::lightyellow, &Colors::lightyellow },
539
+ { ColorNames::lime, &Colors::lime },
540
+ { ColorNames::limegreen, &Colors::limegreen },
541
+ { ColorNames::linen, &Colors::linen },
542
+ { ColorNames::maroon, &Colors::maroon },
543
+ { ColorNames::mediumaquamarine, &Colors::mediumaquamarine },
544
+ { ColorNames::mediumblue, &Colors::mediumblue },
545
+ { ColorNames::mediumorchid, &Colors::mediumorchid },
546
+ { ColorNames::mediumpurple, &Colors::mediumpurple },
547
+ { ColorNames::mediumseagreen, &Colors::mediumseagreen },
548
+ { ColorNames::mediumslateblue, &Colors::mediumslateblue },
549
+ { ColorNames::mediumspringgreen, &Colors::mediumspringgreen },
550
+ { ColorNames::mediumturquoise, &Colors::mediumturquoise },
551
+ { ColorNames::mediumvioletred, &Colors::mediumvioletred },
552
+ { ColorNames::midnightblue, &Colors::midnightblue },
553
+ { ColorNames::mintcream, &Colors::mintcream },
554
+ { ColorNames::mistyrose, &Colors::mistyrose },
555
+ { ColorNames::moccasin, &Colors::moccasin },
556
+ { ColorNames::navajowhite, &Colors::navajowhite },
557
+ { ColorNames::navy, &Colors::navy },
558
+ { ColorNames::oldlace, &Colors::oldlace },
559
+ { ColorNames::olive, &Colors::olive },
560
+ { ColorNames::olivedrab, &Colors::olivedrab },
561
+ { ColorNames::orange, &Colors::orange },
562
+ { ColorNames::orangered, &Colors::orangered },
563
+ { ColorNames::orchid, &Colors::orchid },
564
+ { ColorNames::palegoldenrod, &Colors::palegoldenrod },
565
+ { ColorNames::palegreen, &Colors::palegreen },
566
+ { ColorNames::paleturquoise, &Colors::paleturquoise },
567
+ { ColorNames::palevioletred, &Colors::palevioletred },
568
+ { ColorNames::papayawhip, &Colors::papayawhip },
569
+ { ColorNames::peachpuff, &Colors::peachpuff },
570
+ { ColorNames::peru, &Colors::peru },
571
+ { ColorNames::pink, &Colors::pink },
572
+ { ColorNames::plum, &Colors::plum },
573
+ { ColorNames::powderblue, &Colors::powderblue },
574
+ { ColorNames::purple, &Colors::purple },
575
+ { ColorNames::red, &Colors::red },
576
+ { ColorNames::rosybrown, &Colors::rosybrown },
577
+ { ColorNames::royalblue, &Colors::royalblue },
578
+ { ColorNames::saddlebrown, &Colors::saddlebrown },
579
+ { ColorNames::salmon, &Colors::salmon },
580
+ { ColorNames::sandybrown, &Colors::sandybrown },
581
+ { ColorNames::seagreen, &Colors::seagreen },
582
+ { ColorNames::seashell, &Colors::seashell },
583
+ { ColorNames::sienna, &Colors::sienna },
584
+ { ColorNames::silver, &Colors::silver },
585
+ { ColorNames::skyblue, &Colors::skyblue },
586
+ { ColorNames::slateblue, &Colors::slateblue },
587
+ { ColorNames::slategray, &Colors::slategray },
588
+ { ColorNames::slategrey, &Colors::slategrey },
589
+ { ColorNames::snow, &Colors::snow },
590
+ { ColorNames::springgreen, &Colors::springgreen },
591
+ { ColorNames::steelblue, &Colors::steelblue },
592
+ { ColorNames::tan, &Colors::tan },
593
+ { ColorNames::teal, &Colors::teal },
594
+ { ColorNames::thistle, &Colors::thistle },
595
+ { ColorNames::tomato, &Colors::tomato },
596
+ { ColorNames::turquoise, &Colors::turquoise },
597
+ { ColorNames::violet, &Colors::violet },
598
+ { ColorNames::wheat, &Colors::wheat },
599
+ { ColorNames::white, &Colors::white },
600
+ { ColorNames::whitesmoke, &Colors::whitesmoke },
601
+ { ColorNames::yellow, &Colors::yellow },
602
+ { ColorNames::yellowgreen, &Colors::yellowgreen },
603
+ { ColorNames::rebeccapurple, &Colors::rebeccapurple },
604
+ { ColorNames::transparent, &Colors::transparent }
605
+ };
606
+
607
+ const Color* name_to_color(const char* key)
608
+ {
609
+ auto p = names_to_colors.find(key);
610
+ if (p != names_to_colors.end()) {
611
+ return p->second;
612
+ }
613
+ return 0;
614
+ }
615
+
616
+ const Color* name_to_color(const std::string& key)
617
+ {
618
+ return name_to_color(key.c_str());
619
+ }
620
+
621
+ const char* color_to_name(const int key)
622
+ {
623
+ auto p = colors_to_names.find(key);
624
+ if (p != colors_to_names.end()) {
625
+ return p->second;
626
+ }
627
+ return 0;
628
+ }
629
+
630
+ const char* color_to_name(const double key)
631
+ {
632
+ return color_to_name((int)key);
633
+ }
634
+
635
+ const char* color_to_name(const Color& c)
636
+ {
637
+ double key = c.r() * 0x10000
638
+ + c.g() * 0x100
639
+ + c.b();
640
+ return color_to_name(key);
641
+ }
642
+
643
+ }