1 /* 2 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Joseph Pecoraro 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 15 * its contributors may be used to endorse or promote products derived 16 * from this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 WebInspector.Color = function(str) 31 { 32 this.value = str; 33 this._parse(); 34 } 35 36 WebInspector.Color.prototype = { 37 get shorthex() 38 { 39 if ("_short" in this) 40 return this._short; 41 42 if (!this.simple) 43 return null; 44 45 var hex = this.hex; 46 if (hex.charAt(0) === hex.charAt(1) && hex.charAt(2) === hex.charAt(3) && hex.charAt(4) === hex.charAt(5)) 47 this._short = hex.charAt(0) + hex.charAt(2) + hex.charAt(4); 48 else 49 this._short = hex; 50 51 return this._short; 52 }, 53 54 get hex() 55 { 56 if (!this.simple) 57 return null; 58 59 return this._hex; 60 }, 61 62 set hex(x) 63 { 64 this._hex = x; 65 }, 66 67 get rgb() 68 { 69 if ("_rgb" in this) 70 return this._rgb; 71 72 if (this.simple) 73 this._rgb = this._hexToRGB(this.hex); 74 else { 75 var rgba = this.rgba; 76 this._rgb = [rgba[0], rgba[1], rgba[2]]; 77 } 78 79 return this._rgb; 80 }, 81 82 set rgb(x) 83 { 84 this._rgb = x; 85 }, 86 87 get hsl() 88 { 89 if ("_hsl" in this) 90 return this._hsl; 91 92 this._hsl = this._rgbToHSL(this.rgb); 93 return this._hsl; 94 }, 95 96 set hsl(x) 97 { 98 this._hsl = x; 99 }, 100 101 get nickname() 102 { 103 if (typeof this._nickname !== "undefined") // would be set on parse if there was a nickname 104 return this._nickname; 105 else 106 return null; 107 }, 108 109 set nickname(x) 110 { 111 this._nickname = x; 112 }, 113 114 get rgba() 115 { 116 return this._rgba; 117 }, 118 119 set rgba(x) 120 { 121 this._rgba = x; 122 }, 123 124 get hsla() 125 { 126 return this._hsla; 127 }, 128 129 set hsla(x) 130 { 131 this._hsla = x; 132 }, 133 134 hasShortHex: function() 135 { 136 var shorthex = this.shorthex; 137 return (shorthex && shorthex.length === 3); 138 }, 139 140 toString: function(format) 141 { 142 if (!format) 143 format = this.format; 144 145 switch (format) { 146 case "original": 147 return this.value; 148 case "rgb": 149 return "rgb(" + this.rgb.join(", ") + ")"; 150 case "rgba": 151 return "rgba(" + this.rgba.join(", ") + ")"; 152 case "hsl": 153 var hsl = this.hsl; 154 return "hsl(" + hsl[0] + ", " + hsl[1] + "%, " + hsl[2] + "%)"; 155 case "hsla": 156 var hsla = this.hsla; 157 return "hsla(" + hsla[0] + ", " + hsla[1] + "%, " + hsla[2] + "%, " + hsla[3] + ")"; 158 case "hex": 159 return "#" + this.hex; 160 case "shorthex": 161 return "#" + this.shorthex; 162 case "nickname": 163 return this.nickname; 164 } 165 166 throw "invalid color format"; 167 }, 168 169 _rgbToHex: function(rgb) 170 { 171 var r = parseInt(rgb[0]).toString(16); 172 var g = parseInt(rgb[1]).toString(16); 173 var b = parseInt(rgb[2]).toString(16); 174 if (r.length === 1) 175 r = "0" + r; 176 if (g.length === 1) 177 g = "0" + g; 178 if (b.length === 1) 179 b = "0" + b; 180 181 return (r + g + b).toUpperCase(); 182 }, 183 184 _hexToRGB: function(hex) 185 { 186 var r = parseInt(hex.substring(0,2), 16); 187 var g = parseInt(hex.substring(2,4), 16); 188 var b = parseInt(hex.substring(4,6), 16); 189 190 return [r, g, b]; 191 }, 192 193 _rgbToHSL: function(rgb) 194 { 195 var r = parseInt(rgb[0]) / 255; 196 var g = parseInt(rgb[1]) / 255; 197 var b = parseInt(rgb[2]) / 255; 198 var max = Math.max(r, g, b); 199 var min = Math.min(r, g, b); 200 var diff = max - min; 201 var add = max + min; 202 203 if (min === max) 204 var h = 0; 205 else if (r === max) 206 var h = ((60 * (g - b) / diff) + 360) % 360; 207 else if (g === max) 208 var h = (60 * (b - r) / diff) + 120; 209 else 210 var h = (60 * (r - g) / diff) + 240; 211 212 var l = 0.5 * add; 213 214 if (l === 0) 215 var s = 0; 216 else if (l === 1) 217 var s = 1; 218 else if (l <= 0.5) 219 var s = diff / add; 220 else 221 var s = diff / (2 - add); 222 223 h = Math.round(h); 224 s = Math.round(s*100); 225 l = Math.round(l*100); 226 227 return [h, s, l]; 228 }, 229 230 _hslToRGB: function(hsl) 231 { 232 var h = parseFloat(hsl[0]) / 360; 233 var s = parseFloat(hsl[1]) / 100; 234 var l = parseFloat(hsl[2]) / 100; 235 236 if (l <= 0.5) 237 var q = l * (1 + s); 238 else 239 var q = l + s - (l * s); 240 241 var p = 2 * l - q; 242 243 var tr = h + (1 / 3); 244 var tg = h; 245 var tb = h - (1 / 3); 246 247 var r = Math.round(hueToRGB(p, q, tr) * 255); 248 var g = Math.round(hueToRGB(p, q, tg) * 255); 249 var b = Math.round(hueToRGB(p, q, tb) * 255); 250 return [r, g, b]; 251 252 function hueToRGB(p, q, h) { 253 if (h < 0) 254 h += 1; 255 else if (h > 1) 256 h -= 1; 257 258 if ((h * 6) < 1) 259 return p + (q - p) * h * 6; 260 else if ((h * 2) < 1) 261 return q; 262 else if ((h * 3) < 2) 263 return p + (q - p) * ((2 / 3) - h) * 6; 264 else 265 return p; 266 } 267 }, 268 269 _rgbaToHSLA: function(rgba) 270 { 271 var alpha = rgba[3]; 272 var hsl = this._rgbToHSL(rgba) 273 hsl.push(alpha); 274 return hsl; 275 }, 276 277 _hslaToRGBA: function(hsla) 278 { 279 var alpha = hsla[3]; 280 var rgb = this._hslToRGB(hsla); 281 rgb.push(alpha); 282 return rgb; 283 }, 284 285 _parse: function() 286 { 287 // Special Values - Advanced but Must Be Parsed First - transparent 288 var value = this.value.toLowerCase().replace(/%|\s+/g, ""); 289 if (value in WebInspector.Color.AdvancedNickNames) { 290 this.format = "nickname"; 291 var set = WebInspector.Color.AdvancedNickNames[value]; 292 this.simple = false; 293 this.rgba = set[0]; 294 this.hsla = set[1]; 295 this.nickname = set[2]; 296 this.alpha = set[0][3]; 297 return; 298 } 299 300 // Simple - #hex, rgb(), nickname, hsl() 301 var simple = /^(?:#([0-9a-f]{3,6})|rgb\(([^)]+)\)|(\w+)|hsl\(([^)]+)\))$/i; 302 var match = this.value.match(simple); 303 if (match) { 304 this.simple = true; 305 306 if (match[1]) { // hex 307 var hex = match[1].toUpperCase(); 308 if (hex.length === 3) { 309 this.format = "shorthex"; 310 this.hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2); 311 } else { 312 this.format = "hex"; 313 this.hex = hex; 314 } 315 } else if (match[2]) { // rgb 316 this.format = "rgb"; 317 var rgb = match[2].split(/\s*,\s*/); 318 this.rgb = rgb; 319 this.hex = this._rgbToHex(rgb); 320 } else if (match[3]) { // nickname 321 var nickname = match[3].toLowerCase(); 322 if (nickname in WebInspector.Color.Nicknames) { 323 this.format = "nickname"; 324 this.hex = WebInspector.Color.Nicknames[nickname]; 325 } else // unknown name 326 throw "unknown color name"; 327 } else if (match[4]) { // hsl 328 this.format = "hsl"; 329 var hsl = match[4].replace(/%/g, "").split(/\s*,\s*/); 330 this.hsl = hsl; 331 this.rgb = this._hslToRGB(hsl); 332 this.hex = this._rgbToHex(this.rgb); 333 } 334 335 // Fill in the values if this is a known hex color 336 var hex = this.hex; 337 if (hex && hex in WebInspector.Color.HexTable) { 338 var set = WebInspector.Color.HexTable[hex]; 339 this.rgb = set[0]; 340 this.hsl = set[1]; 341 this.nickname = set[2]; 342 } 343 344 return; 345 } 346 347 // Advanced - rgba(), hsla() 348 var advanced = /^(?:rgba\(([^)]+)\)|hsla\(([^)]+)\))$/; 349 match = this.value.match(advanced); 350 if (match) { 351 this.simple = false; 352 if (match[1]) { // rgba 353 this.format = "rgba"; 354 this.rgba = match[1].split(/\s*,\s*/); 355 this.hsla = this._rgbaToHSLA(this.rgba); 356 this.alpha = this.rgba[3]; 357 } else if (match[2]) { // hsla 358 this.format = "hsla"; 359 this.hsla = match[2].replace(/%/g, "").split(/\s*,\s*/); 360 this.rgba = this._hslaToRGBA(this.hsla); 361 this.alpha = this.hsla[3]; 362 } 363 364 return; 365 } 366 367 // Could not parse as a valid color 368 throw "could not parse color"; 369 } 370 } 371 372 // Simple Values: [rgb, hsl, nickname] 373 WebInspector.Color.HexTable = { 374 "000000": [[0, 0, 0], [0, 0, 0], "black"], 375 "000080": [[0, 0, 128], [240, 100, 25], "navy"], 376 "00008B": [[0, 0, 139], [240, 100, 27], "darkBlue"], 377 "0000CD": [[0, 0, 205], [240, 100, 40], "mediumBlue"], 378 "0000FF": [[0, 0, 255], [240, 100, 50], "blue"], 379 "006400": [[0, 100, 0], [120, 100, 20], "darkGreen"], 380 "008000": [[0, 128, 0], [120, 100, 25], "green"], 381 "008080": [[0, 128, 128], [180, 100, 25], "teal"], 382 "008B8B": [[0, 139, 139], [180, 100, 27], "darkCyan"], 383 "00BFFF": [[0, 191, 255], [195, 100, 50], "deepSkyBlue"], 384 "00CED1": [[0, 206, 209], [181, 100, 41], "darkTurquoise"], 385 "00FA9A": [[0, 250, 154], [157, 100, 49], "mediumSpringGreen"], 386 "00FF00": [[0, 255, 0], [120, 100, 50], "lime"], 387 "00FF7F": [[0, 255, 127], [150, 100, 50], "springGreen"], 388 "00FFFF": [[0, 255, 255], [180, 100, 50], "cyan"], 389 "191970": [[25, 25, 112], [240, 64, 27], "midnightBlue"], 390 "1E90FF": [[30, 144, 255], [210, 100, 56], "dodgerBlue"], 391 "20B2AA": [[32, 178, 170], [177, 70, 41], "lightSeaGreen"], 392 "228B22": [[34, 139, 34], [120, 61, 34], "forestGreen"], 393 "2E8B57": [[46, 139, 87], [146, 50, 36], "seaGreen"], 394 "2F4F4F": [[47, 79, 79], [180, 25, 25], "darkSlateGray"], 395 "32CD32": [[50, 205, 50], [120, 61, 50], "limeGreen"], 396 "3CB371": [[60, 179, 113], [147, 50, 47], "mediumSeaGreen"], 397 "40E0D0": [[64, 224, 208], [174, 72, 56], "turquoise"], 398 "4169E1": [[65, 105, 225], [225, 73, 57], "royalBlue"], 399 "4682B4": [[70, 130, 180], [207, 44, 49], "steelBlue"], 400 "483D8B": [[72, 61, 139], [248, 39, 39], "darkSlateBlue"], 401 "48D1CC": [[72, 209, 204], [178, 60, 55], "mediumTurquoise"], 402 "4B0082": [[75, 0, 130], [275, 100, 25], "indigo"], 403 "556B2F": [[85, 107, 47], [82, 39, 30], "darkOliveGreen"], 404 "5F9EA0": [[95, 158, 160], [182, 25, 50], "cadetBlue"], 405 "6495ED": [[100, 149, 237], [219, 79, 66], "cornflowerBlue"], 406 "66CDAA": [[102, 205, 170], [160, 51, 60], "mediumAquaMarine"], 407 "696969": [[105, 105, 105], [0, 0, 41], "dimGray"], 408 "6A5ACD": [[106, 90, 205], [248, 53, 58], "slateBlue"], 409 "6B8E23": [[107, 142, 35], [80, 60, 35], "oliveDrab"], 410 "708090": [[112, 128, 144], [210, 13, 50], "slateGray"], 411 "778899": [[119, 136, 153], [210, 14, 53], "lightSlateGray"], 412 "7B68EE": [[123, 104, 238], [249, 80, 67], "mediumSlateBlue"], 413 "7CFC00": [[124, 252, 0], [90, 100, 49], "lawnGreen"], 414 "7FFF00": [[127, 255, 0], [90, 100, 50], "chartreuse"], 415 "7FFFD4": [[127, 255, 212], [160, 100, 75], "aquamarine"], 416 "800000": [[128, 0, 0], [0, 100, 25], "maroon"], 417 "800080": [[128, 0, 128], [300, 100, 25], "purple"], 418 "808000": [[128, 128, 0], [60, 100, 25], "olive"], 419 "808080": [[128, 128, 128], [0, 0, 50], "gray"], 420 "87CEEB": [[135, 206, 235], [197, 71, 73], "skyBlue"], 421 "87CEFA": [[135, 206, 250], [203, 92, 75], "lightSkyBlue"], 422 "8A2BE2": [[138, 43, 226], [271, 76, 53], "blueViolet"], 423 "8B0000": [[139, 0, 0], [0, 100, 27], "darkRed"], 424 "8B008B": [[139, 0, 139], [300, 100, 27], "darkMagenta"], 425 "8B4513": [[139, 69, 19], [25, 76, 31], "saddleBrown"], 426 "8FBC8F": [[143, 188, 143], [120, 25, 65], "darkSeaGreen"], 427 "90EE90": [[144, 238, 144], [120, 73, 75], "lightGreen"], 428 "9370D8": [[147, 112, 219], [260, 60, 65], "mediumPurple"], 429 "9400D3": [[148, 0, 211], [282, 100, 41], "darkViolet"], 430 "98FB98": [[152, 251, 152], [120, 93, 79], "paleGreen"], 431 "9932CC": [[153, 50, 204], [280, 61, 50], "darkOrchid"], 432 "9ACD32": [[154, 205, 50], [80, 61, 50], "yellowGreen"], 433 "A0522D": [[160, 82, 45], [19, 56, 40], "sienna"], 434 "A52A2A": [[165, 42, 42], [0, 59, 41], "brown"], 435 "A9A9A9": [[169, 169, 169], [0, 0, 66], "darkGray"], 436 "ADD8E6": [[173, 216, 230], [195, 53, 79], "lightBlue"], 437 "ADFF2F": [[173, 255, 47], [84, 100, 59], "greenYellow"], 438 "AFEEEE": [[175, 238, 238], [180, 65, 81], "paleTurquoise"], 439 "B0C4DE": [[176, 196, 222], [214, 41, 78], "lightSteelBlue"], 440 "B0E0E6": [[176, 224, 230], [187, 52, 80], "powderBlue"], 441 "B22222": [[178, 34, 34], [0, 68, 42], "fireBrick"], 442 "B8860B": [[184, 134, 11], [43, 89, 38], "darkGoldenrod"], 443 "BA55D3": [[186, 85, 211], [288, 59, 58], "mediumOrchid"], 444 "BC8F8F": [[188, 143, 143], [0, 25, 65], "rosyBrown"], 445 "BDB76B": [[189, 183, 107], [56, 38, 58], "darkKhaki"], 446 "C0C0C0": [[192, 192, 192], [0, 0, 75], "silver"], 447 "C71585": [[199, 21, 133], [322, 81, 43], "mediumVioletRed"], 448 "CD5C5C": [[205, 92, 92], [0, 53, 58], "indianRed"], 449 "CD853F": [[205, 133, 63], [30, 59, 53], "peru"], 450 "D2691E": [[210, 105, 30], [25, 75, 47], "chocolate"], 451 "D2B48C": [[210, 180, 140], [34, 44, 69], "tan"], 452 "D3D3D3": [[211, 211, 211], [0, 0, 83], "lightGrey"], 453 "D87093": [[219, 112, 147], [340, 60, 65], "paleVioletRed"], 454 "D8BFD8": [[216, 191, 216], [300, 24, 80], "thistle"], 455 "DA70D6": [[218, 112, 214], [302, 59, 65], "orchid"], 456 "DAA520": [[218, 165, 32], [43, 74, 49], "goldenrod"], 457 "DC143C": [[237, 164, 61], [35, 83, 58], "crimson"], 458 "DCDCDC": [[220, 220, 220], [0, 0, 86], "gainsboro"], 459 "DDA0DD": [[221, 160, 221], [300, 47, 75], "plum"], 460 "DEB887": [[222, 184, 135], [34, 57, 70], "burlyWood"], 461 "E0FFFF": [[224, 255, 255], [180, 100, 94], "lightCyan"], 462 "E6E6FA": [[230, 230, 250], [240, 67, 94], "lavender"], 463 "E9967A": [[233, 150, 122], [15, 72, 70], "darkSalmon"], 464 "EE82EE": [[238, 130, 238], [300, 76, 72], "violet"], 465 "EEE8AA": [[238, 232, 170], [55, 67, 80], "paleGoldenrod"], 466 "F08080": [[240, 128, 128], [0, 79, 72], "lightCoral"], 467 "F0E68C": [[240, 230, 140], [54, 77, 75], "khaki"], 468 "F0F8FF": [[240, 248, 255], [208, 100, 97], "aliceBlue"], 469 "F0FFF0": [[240, 255, 240], [120, 100, 97], "honeyDew"], 470 "F0FFFF": [[240, 255, 255], [180, 100, 97], "azure"], 471 "F4A460": [[244, 164, 96], [28, 87, 67], "sandyBrown"], 472 "F5DEB3": [[245, 222, 179], [39, 77, 83], "wheat"], 473 "F5F5DC": [[245, 245, 220], [60, 56, 91], "beige"], 474 "F5F5F5": [[245, 245, 245], [0, 0, 96], "whiteSmoke"], 475 "F5FFFA": [[245, 255, 250], [150, 100, 98], "mintCream"], 476 "F8F8FF": [[248, 248, 255], [240, 100, 99], "ghostWhite"], 477 "FA8072": [[250, 128, 114], [6, 93, 71], "salmon"], 478 "FAEBD7": [[250, 235, 215], [34, 78, 91], "antiqueWhite"], 479 "FAF0E6": [[250, 240, 230], [30, 67, 94], "linen"], 480 "FAFAD2": [[250, 250, 210], [60, 80, 90], "lightGoldenrodYellow"], 481 "FDF5E6": [[253, 245, 230], [39, 85, 95], "oldLace"], 482 "FF0000": [[255, 0, 0], [0, 100, 50], "red"], 483 "FF00FF": [[255, 0, 255], [300, 100, 50], "magenta"], 484 "FF1493": [[255, 20, 147], [328, 100, 54], "deepPink"], 485 "FF4500": [[255, 69, 0], [16, 100, 50], "orangeRed"], 486 "FF6347": [[255, 99, 71], [9, 100, 64], "tomato"], 487 "FF69B4": [[255, 105, 180], [330, 100, 71], "hotPink"], 488 "FF7F50": [[255, 127, 80], [16, 100, 66], "coral"], 489 "FF8C00": [[255, 140, 0], [33, 100, 50], "darkOrange"], 490 "FFA07A": [[255, 160, 122], [17, 100, 74], "lightSalmon"], 491 "FFA500": [[255, 165, 0], [39, 100, 50], "orange"], 492 "FFB6C1": [[255, 182, 193], [351, 100, 86], "lightPink"], 493 "FFC0CB": [[255, 192, 203], [350, 100, 88], "pink"], 494 "FFD700": [[255, 215, 0], [51, 100, 50], "gold"], 495 "FFDAB9": [[255, 218, 185], [28, 100, 86], "peachPuff"], 496 "FFDEAD": [[255, 222, 173], [36, 100, 84], "navajoWhite"], 497 "FFE4B5": [[255, 228, 181], [38, 100, 85], "moccasin"], 498 "FFE4C4": [[255, 228, 196], [33, 100, 88], "bisque"], 499 "FFE4E1": [[255, 228, 225], [6, 100, 94], "mistyRose"], 500 "FFEBCD": [[255, 235, 205], [36, 100, 90], "blanchedAlmond"], 501 "FFEFD5": [[255, 239, 213], [37, 100, 92], "papayaWhip"], 502 "FFF0F5": [[255, 240, 245], [340, 100, 97], "lavenderBlush"], 503 "FFF5EE": [[255, 245, 238], [25, 100, 97], "seaShell"], 504 "FFF8DC": [[255, 248, 220], [48, 100, 93], "cornsilk"], 505 "FFFACD": [[255, 250, 205], [54, 100, 90], "lemonChiffon"], 506 "FFFAF0": [[255, 250, 240], [40, 100, 97], "floralWhite"], 507 "FFFAFA": [[255, 250, 250], [0, 100, 99], "snow"], 508 "FFFF00": [[255, 255, 0], [60, 100, 50], "yellow"], 509 "FFFFE0": [[255, 255, 224], [60, 100, 94], "lightYellow"], 510 "FFFFF0": [[255, 255, 240], [60, 100, 97], "ivory"], 511 "FFFFFF": [[255, 255, 255], [0, 100, 100], "white"] 512 }; 513 514 // Simple Values 515 WebInspector.Color.Nicknames = { 516 "aliceblue": "F0F8FF", 517 "antiquewhite": "FAEBD7", 518 "aqua": "00FFFF", 519 "aquamarine": "7FFFD4", 520 "azure": "F0FFFF", 521 "beige": "F5F5DC", 522 "bisque": "FFE4C4", 523 "black": "000000", 524 "blanchedalmond": "FFEBCD", 525 "blue": "0000FF", 526 "blueviolet": "8A2BE2", 527 "brown": "A52A2A", 528 "burlywood": "DEB887", 529 "cadetblue": "5F9EA0", 530 "chartreuse": "7FFF00", 531 "chocolate": "D2691E", 532 "coral": "FF7F50", 533 "cornflowerblue": "6495ED", 534 "cornsilk": "FFF8DC", 535 "crimson": "DC143C", 536 "cyan": "00FFFF", 537 "darkblue": "00008B", 538 "darkcyan": "008B8B", 539 "darkgoldenrod": "B8860B", 540 "darkgray": "A9A9A9", 541 "darkgreen": "006400", 542 "darkkhaki": "BDB76B", 543 "darkmagenta": "8B008B", 544 "darkolivegreen": "556B2F", 545 "darkorange": "FF8C00", 546 "darkorchid": "9932CC", 547 "darkred": "8B0000", 548 "darksalmon": "E9967A", 549 "darkseagreen": "8FBC8F", 550 "darkslateblue": "483D8B", 551 "darkslategray": "2F4F4F", 552 "darkturquoise": "00CED1", 553 "darkviolet": "9400D3", 554 "deeppink": "FF1493", 555 "deepskyblue": "00BFFF", 556 "dimgray": "696969", 557 "dodgerblue": "1E90FF", 558 "firebrick": "B22222", 559 "floralwhite": "FFFAF0", 560 "forestgreen": "228B22", 561 "fuchsia": "FF00FF", 562 "gainsboro": "DCDCDC", 563 "ghostwhite": "F8F8FF", 564 "gold": "FFD700", 565 "goldenrod": "DAA520", 566 "gray": "808080", 567 "green": "008000", 568 "greenyellow": "ADFF2F", 569 "honeydew": "F0FFF0", 570 "hotpink": "FF69B4", 571 "indianred": "CD5C5C", 572 "indigo": "4B0082", 573 "ivory": "FFFFF0", 574 "khaki": "F0E68C", 575 "lavender": "E6E6FA", 576 "lavenderblush": "FFF0F5", 577 "lawngreen": "7CFC00", 578 "lemonchiffon": "FFFACD", 579 "lightblue": "ADD8E6", 580 "lightcoral": "F08080", 581 "lightcyan": "E0FFFF", 582 "lightgoldenrodyellow": "FAFAD2", 583 "lightgreen": "90EE90", 584 "lightgrey": "D3D3D3", 585 "lightpink": "FFB6C1", 586 "lightsalmon": "FFA07A", 587 "lightseagreen": "20B2AA", 588 "lightskyblue": "87CEFA", 589 "lightslategray": "778899", 590 "lightsteelblue": "B0C4DE", 591 "lightyellow": "FFFFE0", 592 "lime": "00FF00", 593 "limegreen": "32CD32", 594 "linen": "FAF0E6", 595 "magenta": "FF00FF", 596 "maroon": "800000", 597 "mediumaquamarine": "66CDAA", 598 "mediumblue": "0000CD", 599 "mediumorchid": "BA55D3", 600 "mediumpurple": "9370DB", 601 "mediumseagreen": "3CB371", 602 "mediumslateblue": "7B68EE", 603 "mediumspringgreen": "00FA9A", 604 "mediumturquoise": "48D1CC", 605 "mediumvioletred": "C71585", 606 "midnightblue": "191970", 607 "mintcream": "F5FFFA", 608 "mistyrose": "FFE4E1", 609 "moccasin": "FFE4B5", 610 "navajowhite": "FFDEAD", 611 "navy": "000080", 612 "oldlace": "FDF5E6", 613 "olive": "808000", 614 "olivedrab": "6B8E23", 615 "orange": "FFA500", 616 "orangered": "FF4500", 617 "orchid": "DA70D6", 618 "palegoldenrod": "EEE8AA", 619 "palegreen": "98FB98", 620 "paleturquoise": "AFEEEE", 621 "palevioletred": "DB7093", 622 "papayawhip": "FFEFD5", 623 "peachpuff": "FFDAB9", 624 "peru": "CD853F", 625 "pink": "FFC0CB", 626 "plum": "DDA0DD", 627 "powderblue": "B0E0E6", 628 "purple": "800080", 629 "red": "FF0000", 630 "rosybrown": "BC8F8F", 631 "royalblue": "4169E1", 632 "saddlebrown": "8B4513", 633 "salmon": "FA8072", 634 "sandybrown": "F4A460", 635 "seagreen": "2E8B57", 636 "seashell": "FFF5EE", 637 "sienna": "A0522D", 638 "silver": "C0C0C0", 639 "skyblue": "87CEEB", 640 "slateblue": "6A5ACD", 641 "slategray": "708090", 642 "snow": "FFFAFA", 643 "springgreen": "00FF7F", 644 "steelblue": "4682B4", 645 "tan": "D2B48C", 646 "teal": "008080", 647 "thistle": "D8BFD8", 648 "tomato": "FF6347", 649 "turquoise": "40E0D0", 650 "violet": "EE82EE", 651 "wheat": "F5DEB3", 652 "white": "FFFFFF", 653 "whitesmoke": "F5F5F5", 654 "yellow": "FFFF00", 655 "yellowgreen": "9ACD32" 656 }; 657 658 // Advanced Values [rgba, hsla, nickname] 659 WebInspector.Color.AdvancedNickNames = { 660 "transparent": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"], 661 "rgba(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"], 662 "hsla(0,0,0,0)": [[0, 0, 0, 0], [0, 0, 0, 0], "transparent"], 663 }; 664