Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

321 lines
14KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2015 - ROLI Ltd.
  5. Permission is granted to use this software under the terms of either:
  6. a) the GPL v2 (or any later version)
  7. b) the Affero GPL v3
  8. Details of these licenses can be found at: www.gnu.org/licenses
  9. JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
  10. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  11. A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. ------------------------------------------------------------------------------
  13. To release a closed-source product which uses JUCE, commercial licenses are
  14. available: visit www.juce.com for more information.
  15. ==============================================================================
  16. */
  17. const Colour Colours::transparentBlack (0);
  18. const Colour Colours::transparentWhite (0x00ffffff);
  19. const Colour Colours::aliceblue (0xfff0f8ff);
  20. const Colour Colours::antiquewhite (0xfffaebd7);
  21. const Colour Colours::aqua (0xff00ffff);
  22. const Colour Colours::aquamarine (0xff7fffd4);
  23. const Colour Colours::azure (0xfff0ffff);
  24. const Colour Colours::beige (0xfff5f5dc);
  25. const Colour Colours::bisque (0xffffe4c4);
  26. const Colour Colours::black (0xff000000);
  27. const Colour Colours::blanchedalmond (0xffffebcd);
  28. const Colour Colours::blue (0xff0000ff);
  29. const Colour Colours::blueviolet (0xff8a2be2);
  30. const Colour Colours::brown (0xffa52a2a);
  31. const Colour Colours::burlywood (0xffdeb887);
  32. const Colour Colours::cadetblue (0xff5f9ea0);
  33. const Colour Colours::chartreuse (0xff7fff00);
  34. const Colour Colours::chocolate (0xffd2691e);
  35. const Colour Colours::coral (0xffff7f50);
  36. const Colour Colours::cornflowerblue (0xff6495ed);
  37. const Colour Colours::cornsilk (0xfffff8dc);
  38. const Colour Colours::crimson (0xffdc143c);
  39. const Colour Colours::cyan (0xff00ffff);
  40. const Colour Colours::darkblue (0xff00008b);
  41. const Colour Colours::darkcyan (0xff008b8b);
  42. const Colour Colours::darkgoldenrod (0xffb8860b);
  43. const Colour Colours::darkgrey (0xff555555);
  44. const Colour Colours::darkgreen (0xff006400);
  45. const Colour Colours::darkkhaki (0xffbdb76b);
  46. const Colour Colours::darkmagenta (0xff8b008b);
  47. const Colour Colours::darkolivegreen (0xff556b2f);
  48. const Colour Colours::darkorange (0xffff8c00);
  49. const Colour Colours::darkorchid (0xff9932cc);
  50. const Colour Colours::darkred (0xff8b0000);
  51. const Colour Colours::darksalmon (0xffe9967a);
  52. const Colour Colours::darkseagreen (0xff8fbc8f);
  53. const Colour Colours::darkslateblue (0xff483d8b);
  54. const Colour Colours::darkslategrey (0xff2f4f4f);
  55. const Colour Colours::darkturquoise (0xff00ced1);
  56. const Colour Colours::darkviolet (0xff9400d3);
  57. const Colour Colours::deeppink (0xffff1493);
  58. const Colour Colours::deepskyblue (0xff00bfff);
  59. const Colour Colours::dimgrey (0xff696969);
  60. const Colour Colours::dodgerblue (0xff1e90ff);
  61. const Colour Colours::firebrick (0xffb22222);
  62. const Colour Colours::floralwhite (0xfffffaf0);
  63. const Colour Colours::forestgreen (0xff228b22);
  64. const Colour Colours::fuchsia (0xffff00ff);
  65. const Colour Colours::gainsboro (0xffdcdcdc);
  66. const Colour Colours::gold (0xffffd700);
  67. const Colour Colours::goldenrod (0xffdaa520);
  68. const Colour Colours::grey (0xff808080);
  69. const Colour Colours::green (0xff008000);
  70. const Colour Colours::greenyellow (0xffadff2f);
  71. const Colour Colours::honeydew (0xfff0fff0);
  72. const Colour Colours::hotpink (0xffff69b4);
  73. const Colour Colours::indianred (0xffcd5c5c);
  74. const Colour Colours::indigo (0xff4b0082);
  75. const Colour Colours::ivory (0xfffffff0);
  76. const Colour Colours::khaki (0xfff0e68c);
  77. const Colour Colours::lavender (0xffe6e6fa);
  78. const Colour Colours::lavenderblush (0xfffff0f5);
  79. const Colour Colours::lemonchiffon (0xfffffacd);
  80. const Colour Colours::lightblue (0xffadd8e6);
  81. const Colour Colours::lightcoral (0xfff08080);
  82. const Colour Colours::lightcyan (0xffe0ffff);
  83. const Colour Colours::lightgoldenrodyellow (0xfffafad2);
  84. const Colour Colours::lightgreen (0xff90ee90);
  85. const Colour Colours::lightgrey (0xffd3d3d3);
  86. const Colour Colours::lightpink (0xffffb6c1);
  87. const Colour Colours::lightsalmon (0xffffa07a);
  88. const Colour Colours::lightseagreen (0xff20b2aa);
  89. const Colour Colours::lightskyblue (0xff87cefa);
  90. const Colour Colours::lightslategrey (0xff778899);
  91. const Colour Colours::lightsteelblue (0xffb0c4de);
  92. const Colour Colours::lightyellow (0xffffffe0);
  93. const Colour Colours::lime (0xff00ff00);
  94. const Colour Colours::limegreen (0xff32cd32);
  95. const Colour Colours::linen (0xfffaf0e6);
  96. const Colour Colours::magenta (0xffff00ff);
  97. const Colour Colours::maroon (0xff800000);
  98. const Colour Colours::mediumaquamarine (0xff66cdaa);
  99. const Colour Colours::mediumblue (0xff0000cd);
  100. const Colour Colours::mediumorchid (0xffba55d3);
  101. const Colour Colours::mediumpurple (0xff9370db);
  102. const Colour Colours::mediumseagreen (0xff3cb371);
  103. const Colour Colours::mediumslateblue (0xff7b68ee);
  104. const Colour Colours::mediumspringgreen (0xff00fa9a);
  105. const Colour Colours::mediumturquoise (0xff48d1cc);
  106. const Colour Colours::mediumvioletred (0xffc71585);
  107. const Colour Colours::midnightblue (0xff191970);
  108. const Colour Colours::mintcream (0xfff5fffa);
  109. const Colour Colours::mistyrose (0xffffe4e1);
  110. const Colour Colours::navajowhite (0xffffdead);
  111. const Colour Colours::navy (0xff000080);
  112. const Colour Colours::oldlace (0xfffdf5e6);
  113. const Colour Colours::olive (0xff808000);
  114. const Colour Colours::olivedrab (0xff6b8e23);
  115. const Colour Colours::orange (0xffffa500);
  116. const Colour Colours::orangered (0xffff4500);
  117. const Colour Colours::orchid (0xffda70d6);
  118. const Colour Colours::palegoldenrod (0xffeee8aa);
  119. const Colour Colours::palegreen (0xff98fb98);
  120. const Colour Colours::paleturquoise (0xffafeeee);
  121. const Colour Colours::palevioletred (0xffdb7093);
  122. const Colour Colours::papayawhip (0xffffefd5);
  123. const Colour Colours::peachpuff (0xffffdab9);
  124. const Colour Colours::peru (0xffcd853f);
  125. const Colour Colours::pink (0xffffc0cb);
  126. const Colour Colours::plum (0xffdda0dd);
  127. const Colour Colours::powderblue (0xffb0e0e6);
  128. const Colour Colours::purple (0xff800080);
  129. const Colour Colours::red (0xffff0000);
  130. const Colour Colours::rosybrown (0xffbc8f8f);
  131. const Colour Colours::royalblue (0xff4169e1);
  132. const Colour Colours::saddlebrown (0xff8b4513);
  133. const Colour Colours::salmon (0xfffa8072);
  134. const Colour Colours::sandybrown (0xfff4a460);
  135. const Colour Colours::seagreen (0xff2e8b57);
  136. const Colour Colours::seashell (0xfffff5ee);
  137. const Colour Colours::sienna (0xffa0522d);
  138. const Colour Colours::silver (0xffc0c0c0);
  139. const Colour Colours::skyblue (0xff87ceeb);
  140. const Colour Colours::slateblue (0xff6a5acd);
  141. const Colour Colours::slategrey (0xff708090);
  142. const Colour Colours::snow (0xfffffafa);
  143. const Colour Colours::springgreen (0xff00ff7f);
  144. const Colour Colours::steelblue (0xff4682b4);
  145. const Colour Colours::tan (0xffd2b48c);
  146. const Colour Colours::teal (0xff008080);
  147. const Colour Colours::thistle (0xffd8bfd8);
  148. const Colour Colours::tomato (0xffff6347);
  149. const Colour Colours::turquoise (0xff40e0d0);
  150. const Colour Colours::violet (0xffee82ee);
  151. const Colour Colours::wheat (0xfff5deb3);
  152. const Colour Colours::white (0xffffffff);
  153. const Colour Colours::whitesmoke (0xfff5f5f5);
  154. const Colour Colours::yellow (0xffffff00);
  155. const Colour Colours::yellowgreen (0xff9acd32);
  156. //==============================================================================
  157. Colour Colours::findColourForName (const String& colourName,
  158. Colour defaultColour)
  159. {
  160. static const uint32 presets[] =
  161. {
  162. // (first value is the string's hashcode, second is ARGB)
  163. 0x05978fff, 0xff000000, /* black */
  164. 0x06bdcc29, 0xffffffff, /* white */
  165. 0x002e305a, 0xff0000ff, /* blue */
  166. 0x00308adf, 0xff808080, /* grey */
  167. 0x05e0cf03, 0xff008000, /* green */
  168. 0x0001b891, 0xffff0000, /* red */
  169. 0xd43c6474, 0xffffff00, /* yellow */
  170. 0x620886da, 0xfff0f8ff, /* aliceblue */
  171. 0x20a2676a, 0xfffaebd7, /* antiquewhite */
  172. 0x002dcebc, 0xff00ffff, /* aqua */
  173. 0x46bb5f7e, 0xff7fffd4, /* aquamarine */
  174. 0x0590228f, 0xfff0ffff, /* azure */
  175. 0x05947fe4, 0xfff5f5dc, /* beige */
  176. 0xad388e35, 0xffffe4c4, /* bisque */
  177. 0x00674f7e, 0xffffebcd, /* blanchedalmond */
  178. 0x39129959, 0xff8a2be2, /* blueviolet */
  179. 0x059a8136, 0xffa52a2a, /* brown */
  180. 0x89cea8f9, 0xffdeb887, /* burlywood */
  181. 0x0fa260cf, 0xff5f9ea0, /* cadetblue */
  182. 0x6b748956, 0xff7fff00, /* chartreuse */
  183. 0x2903623c, 0xffd2691e, /* chocolate */
  184. 0x05a74431, 0xffff7f50, /* coral */
  185. 0x618d42dd, 0xff6495ed, /* cornflowerblue */
  186. 0xe4b479fd, 0xfffff8dc, /* cornsilk */
  187. 0x3d8c4edf, 0xffdc143c, /* crimson */
  188. 0x002ed323, 0xff00ffff, /* cyan */
  189. 0x67cc74d0, 0xff00008b, /* darkblue */
  190. 0x67cd1799, 0xff008b8b, /* darkcyan */
  191. 0x31bbd168, 0xffb8860b, /* darkgoldenrod */
  192. 0x67cecf55, 0xff555555, /* darkgrey */
  193. 0x920b194d, 0xff006400, /* darkgreen */
  194. 0x923edd4c, 0xffbdb76b, /* darkkhaki */
  195. 0x5c293873, 0xff8b008b, /* darkmagenta */
  196. 0x6b6671fe, 0xff556b2f, /* darkolivegreen */
  197. 0xbcfd2524, 0xffff8c00, /* darkorange */
  198. 0xbcfdf799, 0xff9932cc, /* darkorchid */
  199. 0x55ee0d5b, 0xff8b0000, /* darkred */
  200. 0xc2e5f564, 0xffe9967a, /* darksalmon */
  201. 0x61be858a, 0xff8fbc8f, /* darkseagreen */
  202. 0xc2b0f2bd, 0xff483d8b, /* darkslateblue */
  203. 0xc2b34d42, 0xff2f4f4f, /* darkslategrey */
  204. 0x7cf2b06b, 0xff00ced1, /* darkturquoise */
  205. 0xc8769375, 0xff9400d3, /* darkviolet */
  206. 0x25832862, 0xffff1493, /* deeppink */
  207. 0xfcad568f, 0xff00bfff, /* deepskyblue */
  208. 0x634c8b67, 0xff696969, /* dimgrey */
  209. 0x45c1ce55, 0xff1e90ff, /* dodgerblue */
  210. 0xef19e3cb, 0xffb22222, /* firebrick */
  211. 0xb852b195, 0xfffffaf0, /* floralwhite */
  212. 0xd086fd06, 0xff228b22, /* forestgreen */
  213. 0xe106b6d7, 0xffff00ff, /* fuchsia */
  214. 0x7880d61e, 0xffdcdcdc, /* gainsboro */
  215. 0x00308060, 0xffffd700, /* gold */
  216. 0xb3b3bc1e, 0xffdaa520, /* goldenrod */
  217. 0xbab8a537, 0xffadff2f, /* greenyellow */
  218. 0xe4cacafb, 0xfff0fff0, /* honeydew */
  219. 0x41892743, 0xffff69b4, /* hotpink */
  220. 0xd5796f1a, 0xffcd5c5c, /* indianred */
  221. 0xb969fed2, 0xff4b0082, /* indigo */
  222. 0x05fef6a9, 0xfffffff0, /* ivory */
  223. 0x06149302, 0xfff0e68c, /* khaki */
  224. 0xad5a05c7, 0xffe6e6fa, /* lavender */
  225. 0x7c4d5b99, 0xfffff0f5, /* lavenderblush */
  226. 0x195756f0, 0xfffffacd, /* lemonchiffon */
  227. 0x28e4ea70, 0xffadd8e6, /* lightblue */
  228. 0xf3c7ccdb, 0xfff08080, /* lightcoral */
  229. 0x28e58d39, 0xffe0ffff, /* lightcyan */
  230. 0x21234e3c, 0xfffafad2, /* lightgoldenrodyellow */
  231. 0xf40157ad, 0xff90ee90, /* lightgreen */
  232. 0x28e744f5, 0xffd3d3d3, /* lightgrey */
  233. 0x28eb3b8c, 0xffffb6c1, /* lightpink */
  234. 0x9fb78304, 0xffffa07a, /* lightsalmon */
  235. 0x50632b2a, 0xff20b2aa, /* lightseagreen */
  236. 0x68fb7b25, 0xff87cefa, /* lightskyblue */
  237. 0xa8a35ba2, 0xff778899, /* lightslategrey */
  238. 0xa20d484f, 0xffb0c4de, /* lightsteelblue */
  239. 0xaa2cf10a, 0xffffffe0, /* lightyellow */
  240. 0x0032afd5, 0xff00ff00, /* lime */
  241. 0x607bbc4e, 0xff32cd32, /* limegreen */
  242. 0x06234efa, 0xfffaf0e6, /* linen */
  243. 0x316858a9, 0xffff00ff, /* magenta */
  244. 0xbf8ca470, 0xff800000, /* maroon */
  245. 0xbd58e0b3, 0xff66cdaa, /* mediumaquamarine */
  246. 0x967dfd4f, 0xff0000cd, /* mediumblue */
  247. 0x056f5c58, 0xffba55d3, /* mediumorchid */
  248. 0x07556b71, 0xff9370db, /* mediumpurple */
  249. 0x5369b689, 0xff3cb371, /* mediumseagreen */
  250. 0x066be19e, 0xff7b68ee, /* mediumslateblue */
  251. 0x3256b281, 0xff00fa9a, /* mediumspringgreen */
  252. 0xc0ad9f4c, 0xff48d1cc, /* mediumturquoise */
  253. 0x628e63dd, 0xffc71585, /* mediumvioletred */
  254. 0x168eb32a, 0xff191970, /* midnightblue */
  255. 0x4306b960, 0xfff5fffa, /* mintcream */
  256. 0x4cbc0e6b, 0xffffe4e1, /* mistyrose */
  257. 0xe97218a6, 0xffffdead, /* navajowhite */
  258. 0x00337bb6, 0xff000080, /* navy */
  259. 0xadd2d33e, 0xfffdf5e6, /* oldlace */
  260. 0x064ee1db, 0xff808000, /* olive */
  261. 0x9e33a98a, 0xff6b8e23, /* olivedrab */
  262. 0xc3de262e, 0xffffa500, /* orange */
  263. 0x58bebba3, 0xffff4500, /* orangered */
  264. 0xc3def8a3, 0xffda70d6, /* orchid */
  265. 0x28cb4834, 0xffeee8aa, /* palegoldenrod */
  266. 0x3d9dd619, 0xff98fb98, /* palegreen */
  267. 0x74022737, 0xffafeeee, /* paleturquoise */
  268. 0x15e2ebc8, 0xffdb7093, /* palevioletred */
  269. 0x5fd898e2, 0xffffefd5, /* papayawhip */
  270. 0x93e1b776, 0xffffdab9, /* peachpuff */
  271. 0x003472f8, 0xffcd853f, /* peru */
  272. 0x00348176, 0xffffc0cb, /* pink */
  273. 0x00348d94, 0xffdda0dd, /* plum */
  274. 0xd036be93, 0xffb0e0e6, /* powderblue */
  275. 0xc5c507bc, 0xff800080, /* purple */
  276. 0xa89d65b3, 0xffbc8f8f, /* rosybrown */
  277. 0xbd9413e1, 0xff4169e1, /* royalblue */
  278. 0xf456044f, 0xff8b4513, /* saddlebrown */
  279. 0xc9c6f66e, 0xfffa8072, /* salmon */
  280. 0x0bb131e1, 0xfff4a460, /* sandybrown */
  281. 0x34636c14, 0xff2e8b57, /* seagreen */
  282. 0x3507fb41, 0xfffff5ee, /* seashell */
  283. 0xca348772, 0xffa0522d, /* sienna */
  284. 0xca37d30d, 0xffc0c0c0, /* silver */
  285. 0x80da74fb, 0xff87ceeb, /* skyblue */
  286. 0x44a8dd73, 0xff6a5acd, /* slateblue */
  287. 0x44ab37f8, 0xff708090, /* slategrey */
  288. 0x0035f183, 0xfffffafa, /* snow */
  289. 0xd5440d16, 0xff00ff7f, /* springgreen */
  290. 0x3e1524a5, 0xff4682b4, /* steelblue */
  291. 0x0001bfa1, 0xffd2b48c, /* tan */
  292. 0x0036425c, 0xff008080, /* teal */
  293. 0xafc8858f, 0xffd8bfd8, /* thistle */
  294. 0xcc41600a, 0xffff6347, /* tomato */
  295. 0xfeea9b21, 0xff40e0d0, /* turquoise */
  296. 0xcf57947f, 0xffee82ee, /* violet */
  297. 0x06bdbae7, 0xfff5deb3, /* wheat */
  298. 0x10802ee6, 0xfff5f5f5, /* whitesmoke */
  299. 0xe1b5130f, 0xff9acd32 /* yellowgreen */
  300. };
  301. const uint32 hash = (uint32) colourName.trim().toLowerCase().hashCode();
  302. for (int i = 0; i < numElementsInArray (presets); i += 2)
  303. if (presets [i] == hash)
  304. return Colour (presets [i + 1]);
  305. return defaultColour;
  306. }