Best JavaScript code snippet using taiko
Color.js
Source:Color.js
1import Check from './Check.js';2import defaultValue from './defaultValue.js';3import defined from './defined.js';4import FeatureDetection from './FeatureDetection.js';5import CesiumMath from './Math.js';6 function hue2rgb(m1, m2, h) {7 if (h < 0) {8 h += 1;9 }10 if (h > 1) {11 h -= 1;12 }13 if (h * 6 < 1) {14 return m1 + (m2 - m1) * 6 * h;15 }16 if (h * 2 < 1) {17 return m2;18 }19 if (h * 3 < 2) {20 return m1 + (m2 - m1) * (2 / 3 - h) * 6;21 }22 return m1;23 }24 /**25 * A color, specified using red, green, blue, and alpha values,26 * which range from <code>0</code> (no intensity) to <code>1.0</code> (full intensity).27 * @param {Number} [red=1.0] The red component.28 * @param {Number} [green=1.0] The green component.29 * @param {Number} [blue=1.0] The blue component.30 * @param {Number} [alpha=1.0] The alpha component.31 *32 * @constructor33 * @alias Color34 *35 * @see Packable36 */37 function Color(red, green, blue, alpha) {38 /**39 * The red component.40 * @type {Number}41 * @default 1.042 */43 this.red = defaultValue(red, 1.0);44 /**45 * The green component.46 * @type {Number}47 * @default 1.048 */49 this.green = defaultValue(green, 1.0);50 /**51 * The blue component.52 * @type {Number}53 * @default 1.054 */55 this.blue = defaultValue(blue, 1.0);56 /**57 * The alpha component.58 * @type {Number}59 * @default 1.060 */61 this.alpha = defaultValue(alpha, 1.0);62 }63 /**64 * Creates a Color instance from a {@link Cartesian4}. <code>x</code>, <code>y</code>, <code>z</code>,65 * and <code>w</code> map to <code>red</code>, <code>green</code>, <code>blue</code>, and <code>alpha</code>, respectively.66 *67 * @param {Cartesian4} cartesian The source cartesian.68 * @param {Color} [result] The object onto which to store the result.69 * @returns {Color} The modified result parameter or a new Color instance if one was not provided.70 */71 Color.fromCartesian4 = function(cartesian, result) {72 //>>includeStart('debug', pragmas.debug);73 Check.typeOf.object('cartesian', cartesian);74 //>>includeEnd('debug');75 if (!defined(result)) {76 return new Color(cartesian.x, cartesian.y, cartesian.z, cartesian.w);77 }78 result.red = cartesian.x;79 result.green = cartesian.y;80 result.blue = cartesian.z;81 result.alpha = cartesian.w;82 return result;83 };84 /**85 * Creates a new Color specified using red, green, blue, and alpha values86 * that are in the range of 0 to 255, converting them internally to a range of 0.0 to 1.0.87 *88 * @param {Number} [red=255] The red component.89 * @param {Number} [green=255] The green component.90 * @param {Number} [blue=255] The blue component.91 * @param {Number} [alpha=255] The alpha component.92 * @param {Color} [result] The object onto which to store the result.93 * @returns {Color} The modified result parameter or a new Color instance if one was not provided.94 */95 Color.fromBytes = function(red, green, blue, alpha, result) {96 red = Color.byteToFloat(defaultValue(red, 255.0));97 green = Color.byteToFloat(defaultValue(green, 255.0));98 blue = Color.byteToFloat(defaultValue(blue, 255.0));99 alpha = Color.byteToFloat(defaultValue(alpha, 255.0));100 if (!defined(result)) {101 return new Color(red, green, blue, alpha);102 }103 result.red = red;104 result.green = green;105 result.blue = blue;106 result.alpha = alpha;107 return result;108 };109 /**110 * Creates a new Color that has the same red, green, and blue components111 * of the specified color, but with the specified alpha value.112 *113 * @param {Color} color The base color114 * @param {Number} alpha The new alpha component.115 * @param {Color} [result] The object onto which to store the result.116 * @returns {Color} The modified result parameter or a new Color instance if one was not provided.117 *118 * @example var translucentRed = Cesium.Color.fromAlpha(Cesium.Color.RED, 0.9);119 */120 Color.fromAlpha = function(color, alpha, result) {121 //>>includeStart('debug', pragmas.debug);122 Check.typeOf.object('color', color);123 Check.typeOf.number('alpha', alpha);124 //>>includeEnd('debug');125 if (!defined(result)) {126 return new Color(color.red, color.green, color.blue, alpha);127 }128 result.red = color.red;129 result.green = color.green;130 result.blue = color.blue;131 result.alpha = alpha;132 return result;133 };134 var scratchArrayBuffer;135 var scratchUint32Array;136 var scratchUint8Array;137 if (FeatureDetection.supportsTypedArrays()) {138 scratchArrayBuffer = new ArrayBuffer(4);139 scratchUint32Array = new Uint32Array(scratchArrayBuffer);140 scratchUint8Array = new Uint8Array(scratchArrayBuffer);141 }142 /**143 * Creates a new Color from a single numeric unsigned 32-bit RGBA value, using the endianness144 * of the system.145 *146 * @param {Number} rgba A single numeric unsigned 32-bit RGBA value.147 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.148 * @returns {Color} The color object.149 *150 * @example151 * var color = Cesium.Color.fromRgba(0x67ADDFFF);152 *153 * @see Color#toRgba154 */155 Color.fromRgba = function(rgba, result) {156 // scratchUint32Array and scratchUint8Array share an underlying array buffer157 scratchUint32Array[0] = rgba;158 return Color.fromBytes(scratchUint8Array[0], scratchUint8Array[1], scratchUint8Array[2], scratchUint8Array[3], result);159 };160 /**161 * Creates a Color instance from hue, saturation, and lightness.162 *163 * @param {Number} [hue=0] The hue angle 0...1164 * @param {Number} [saturation=0] The saturation value 0...1165 * @param {Number} [lightness=0] The lightness value 0...1166 * @param {Number} [alpha=1.0] The alpha component 0...1167 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.168 * @returns {Color} The color object.169 *170 * @see {@link http://www.w3.org/TR/css3-color/#hsl-color|CSS color values}171 */172 Color.fromHsl = function(hue, saturation, lightness, alpha, result) {173 hue = defaultValue(hue, 0.0) % 1.0;174 saturation = defaultValue(saturation, 0.0);175 lightness = defaultValue(lightness, 0.0);176 alpha = defaultValue(alpha, 1.0);177 var red = lightness;178 var green = lightness;179 var blue = lightness;180 if (saturation !== 0) {181 var m2;182 if (lightness < 0.5) {183 m2 = lightness * (1 + saturation);184 } else {185 m2 = lightness + saturation - lightness * saturation;186 }187 var m1 = 2.0 * lightness - m2;188 red = hue2rgb(m1, m2, hue + 1 / 3);189 green = hue2rgb(m1, m2, hue);190 blue = hue2rgb(m1, m2, hue - 1 / 3);191 }192 if (!defined(result)) {193 return new Color(red, green, blue, alpha);194 }195 result.red = red;196 result.green = green;197 result.blue = blue;198 result.alpha = alpha;199 return result;200 };201 /**202 * Creates a random color using the provided options. For reproducible random colors, you should203 * call {@link CesiumMath#setRandomNumberSeed} once at the beginning of your application.204 *205 * @param {Object} [options] Object with the following properties:206 * @param {Number} [options.red] If specified, the red component to use instead of a randomized value.207 * @param {Number} [options.minimumRed=0.0] The maximum red value to generate if none was specified.208 * @param {Number} [options.maximumRed=1.0] The minimum red value to generate if none was specified.209 * @param {Number} [options.green] If specified, the green component to use instead of a randomized value.210 * @param {Number} [options.minimumGreen=0.0] The maximum green value to generate if none was specified.211 * @param {Number} [options.maximumGreen=1.0] The minimum green value to generate if none was specified.212 * @param {Number} [options.blue] If specified, the blue component to use instead of a randomized value.213 * @param {Number} [options.minimumBlue=0.0] The maximum blue value to generate if none was specified.214 * @param {Number} [options.maximumBlue=1.0] The minimum blue value to generate if none was specified.215 * @param {Number} [options.alpha] If specified, the alpha component to use instead of a randomized value.216 * @param {Number} [options.minimumAlpha=0.0] The maximum alpha value to generate if none was specified.217 * @param {Number} [options.maximumAlpha=1.0] The minimum alpha value to generate if none was specified.218 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.219 * @returns {Color} The modified result parameter or a new instance if result was undefined.220 *221 * @exception {DeveloperError} minimumRed must be less than or equal to maximumRed.222 * @exception {DeveloperError} minimumGreen must be less than or equal to maximumGreen.223 * @exception {DeveloperError} minimumBlue must be less than or equal to maximumBlue.224 * @exception {DeveloperError} minimumAlpha must be less than or equal to maximumAlpha.225 *226 * @example227 * //Create a completely random color228 * var color = Cesium.Color.fromRandom();229 *230 * //Create a random shade of yellow.231 * var color = Cesium.Color.fromRandom({232 * red : 1.0,233 * green : 1.0,234 * alpha : 1.0235 * });236 *237 * //Create a random bright color.238 * var color = Cesium.Color.fromRandom({239 * minimumRed : 0.75,240 * minimumGreen : 0.75,241 * minimumBlue : 0.75,242 * alpha : 1.0243 * });244 */245 Color.fromRandom = function(options, result) {246 options = defaultValue(options, defaultValue.EMPTY_OBJECT);247 var red = options.red;248 if (!defined(red)) {249 var minimumRed = defaultValue(options.minimumRed, 0);250 var maximumRed = defaultValue(options.maximumRed, 1.0);251 //>>includeStart('debug', pragmas.debug);252 Check.typeOf.number.lessThanOrEquals('minimumRed', minimumRed, maximumRed);253 //>>includeEnd('debug');254 red = minimumRed + (CesiumMath.nextRandomNumber() * (maximumRed - minimumRed));255 }256 var green = options.green;257 if (!defined(green)) {258 var minimumGreen = defaultValue(options.minimumGreen, 0);259 var maximumGreen = defaultValue(options.maximumGreen, 1.0);260 //>>includeStart('debug', pragmas.debug);261 Check.typeOf.number.lessThanOrEquals('minimumGreen', minimumGreen, maximumGreen);262 //>>includeEnd('debug');263 green = minimumGreen + (CesiumMath.nextRandomNumber() * (maximumGreen - minimumGreen));264 }265 var blue = options.blue;266 if (!defined(blue)) {267 var minimumBlue = defaultValue(options.minimumBlue, 0);268 var maximumBlue = defaultValue(options.maximumBlue, 1.0);269 //>>includeStart('debug', pragmas.debug);270 Check.typeOf.number.lessThanOrEquals('minimumBlue', minimumBlue, maximumBlue);271 //>>includeEnd('debug');272 blue = minimumBlue + (CesiumMath.nextRandomNumber() * (maximumBlue - minimumBlue));273 }274 var alpha = options.alpha;275 if (!defined(alpha)) {276 var minimumAlpha = defaultValue(options.minimumAlpha, 0);277 var maximumAlpha = defaultValue(options.maximumAlpha, 1.0);278 //>>includeStart('debug', pragmas.debug);279 Check.typeOf.number.lessThanOrEquals('minumumAlpha', minimumAlpha, maximumAlpha);280 //>>includeEnd('debug');281 alpha = minimumAlpha + (CesiumMath.nextRandomNumber() * (maximumAlpha - minimumAlpha));282 }283 if (!defined(result)) {284 return new Color(red, green, blue, alpha);285 }286 result.red = red;287 result.green = green;288 result.blue = blue;289 result.alpha = alpha;290 return result;291 };292 //#rgb293 var rgbMatcher = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i;294 //#rrggbb295 var rrggbbMatcher = /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i;296 //rgb(), rgba(), or rgb%()297 var rgbParenthesesMatcher = /^rgba?\(\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)\s*,\s*([0-9.]+%?)(?:\s*,\s*([0-9.]+))?\s*\)$/i;298 //hsl(), hsla(), or hsl%()299 var hslParenthesesMatcher = /^hsla?\(\s*([0-9.]+)\s*,\s*([0-9.]+%)\s*,\s*([0-9.]+%)(?:\s*,\s*([0-9.]+))?\s*\)$/i;300 /**301 * Creates a Color instance from a CSS color value.302 *303 * @param {String} color The CSS color value in #rgb, #rrggbb, rgb(), rgba(), hsl(), or hsla() format.304 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.305 * @returns {Color} The color object, or undefined if the string was not a valid CSS color.306 *307 *308 * @example309 * var cesiumBlue = Cesium.Color.fromCssColorString('#67ADDF');310 * var green = Cesium.Color.fromCssColorString('green');311 *312 * @see {@link http://www.w3.org/TR/css3-color|CSS color values}313 */314 Color.fromCssColorString = function(color, result) {315 //>>includeStart('debug', pragmas.debug);316 Check.typeOf.string('color', color);317 //>>includeEnd('debug');318 if (!defined(result)) {319 result = new Color();320 }321 var namedColor = Color[color.toUpperCase()];322 if (defined(namedColor)) {323 Color.clone(namedColor, result);324 return result;325 }326 var matches = rgbMatcher.exec(color);327 if (matches !== null) {328 result.red = parseInt(matches[1], 16) / 15;329 result.green = parseInt(matches[2], 16) / 15.0;330 result.blue = parseInt(matches[3], 16) / 15.0;331 result.alpha = 1.0;332 return result;333 }334 matches = rrggbbMatcher.exec(color);335 if (matches !== null) {336 result.red = parseInt(matches[1], 16) / 255.0;337 result.green = parseInt(matches[2], 16) / 255.0;338 result.blue = parseInt(matches[3], 16) / 255.0;339 result.alpha = 1.0;340 return result;341 }342 matches = rgbParenthesesMatcher.exec(color);343 if (matches !== null) {344 result.red = parseFloat(matches[1]) / ('%' === matches[1].substr(-1) ? 100.0 : 255.0);345 result.green = parseFloat(matches[2]) / ('%' === matches[2].substr(-1) ? 100.0 : 255.0);346 result.blue = parseFloat(matches[3]) / ('%' === matches[3].substr(-1) ? 100.0 : 255.0);347 result.alpha = parseFloat(defaultValue(matches[4], '1.0'));348 return result;349 }350 matches = hslParenthesesMatcher.exec(color);351 if (matches !== null) {352 return Color.fromHsl(parseFloat(matches[1]) / 360.0,353 parseFloat(matches[2]) / 100.0,354 parseFloat(matches[3]) / 100.0,355 parseFloat(defaultValue(matches[4], '1.0')), result);356 }357 result = undefined;358 return result;359 };360 /**361 * The number of elements used to pack the object into an array.362 * @type {Number}363 */364 Color.packedLength = 4;365 /**366 * Stores the provided instance into the provided array.367 *368 * @param {Color} value The value to pack.369 * @param {Number[]} array The array to pack into.370 * @param {Number} [startingIndex=0] The index into the array at which to start packing the elements.371 *372 * @returns {Number[]} The array that was packed into373 */374 Color.pack = function(value, array, startingIndex) {375 //>>includeStart('debug', pragmas.debug);376 Check.typeOf.object('value', value);377 Check.defined('array', array);378 //>>includeEnd('debug');379 startingIndex = defaultValue(startingIndex, 0);380 array[startingIndex++] = value.red;381 array[startingIndex++] = value.green;382 array[startingIndex++] = value.blue;383 array[startingIndex] = value.alpha;384 return array;385 };386 /**387 * Retrieves an instance from a packed array.388 *389 * @param {Number[]} array The packed array.390 * @param {Number} [startingIndex=0] The starting index of the element to be unpacked.391 * @param {Color} [result] The object into which to store the result.392 * @returns {Color} The modified result parameter or a new Color instance if one was not provided.393 */394 Color.unpack = function(array, startingIndex, result) {395 //>>includeStart('debug', pragmas.debug);396 Check.defined('array', array);397 //>>includeEnd('debug');398 startingIndex = defaultValue(startingIndex, 0);399 if (!defined(result)) {400 result = new Color();401 }402 result.red = array[startingIndex++];403 result.green = array[startingIndex++];404 result.blue = array[startingIndex++];405 result.alpha = array[startingIndex];406 return result;407 };408 /**409 * Converts a 'byte' color component in the range of 0 to 255 into410 * a 'float' color component in the range of 0 to 1.0.411 *412 * @param {Number} number The number to be converted.413 * @returns {Number} The converted number.414 */415 Color.byteToFloat = function(number) {416 return number / 255.0;417 };418 /**419 * Converts a 'float' color component in the range of 0 to 1.0 into420 * a 'byte' color component in the range of 0 to 255.421 *422 * @param {Number} number The number to be converted.423 * @returns {Number} The converted number.424 */425 Color.floatToByte = function(number) {426 return number === 1.0 ? 255.0 : (number * 256.0) | 0;427 };428 /**429 * Duplicates a Color.430 *431 * @param {Color} color The Color to duplicate.432 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.433 * @returns {Color} The modified result parameter or a new instance if result was undefined. (Returns undefined if color is undefined)434 */435 Color.clone = function(color, result) {436 if (!defined(color)) {437 return undefined;438 }439 if (!defined(result)) {440 return new Color(color.red, color.green, color.blue, color.alpha);441 }442 result.red = color.red;443 result.green = color.green;444 result.blue = color.blue;445 result.alpha = color.alpha;446 return result;447 };448 /**449 * Returns true if the first Color equals the second color.450 *451 * @param {Color} left The first Color to compare for equality.452 * @param {Color} right The second Color to compare for equality.453 * @returns {Boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.454 */455 Color.equals = function(left, right) {456 return (left === right) || //457 (defined(left) && //458 defined(right) && //459 left.red === right.red && //460 left.green === right.green && //461 left.blue === right.blue && //462 left.alpha === right.alpha);463 };464 /**465 * @private466 */467 Color.equalsArray = function(color, array, offset) {468 return color.red === array[offset] &&469 color.green === array[offset + 1] &&470 color.blue === array[offset + 2] &&471 color.alpha === array[offset + 3];472 };473 /**474 * Returns a duplicate of a Color instance.475 *476 * @param {Color} [result] The object to store the result in, if undefined a new instance will be created.477 * @returns {Color} The modified result parameter or a new instance if result was undefined.478 */479 Color.prototype.clone = function(result) {480 return Color.clone(this, result);481 };482 /**483 * Returns true if this Color equals other.484 *485 * @param {Color} other The Color to compare for equality.486 * @returns {Boolean} <code>true</code> if the Colors are equal; otherwise, <code>false</code>.487 */488 Color.prototype.equals = function(other) {489 return Color.equals(this, other);490 };491 /**492 * Returns <code>true</code> if this Color equals other componentwise within the specified epsilon.493 *494 * @param {Color} other The Color to compare for equality.495 * @param {Number} [epsilon=0.0] The epsilon to use for equality testing.496 * @returns {Boolean} <code>true</code> if the Colors are equal within the specified epsilon; otherwise, <code>false</code>.497 */498 Color.prototype.equalsEpsilon = function(other, epsilon) {499 return (this === other) || //500 ((defined(other)) && //501 (Math.abs(this.red - other.red) <= epsilon) && //502 (Math.abs(this.green - other.green) <= epsilon) && //503 (Math.abs(this.blue - other.blue) <= epsilon) && //504 (Math.abs(this.alpha - other.alpha) <= epsilon));505 };506 /**507 * Creates a string representing this Color in the format '(red, green, blue, alpha)'.508 *509 * @returns {String} A string representing this Color in the format '(red, green, blue, alpha)'.510 */511 Color.prototype.toString = function() {512 return '(' + this.red + ', ' + this.green + ', ' + this.blue + ', ' + this.alpha + ')';513 };514 /**515 * Creates a string containing the CSS color value for this color.516 *517 * @returns {String} The CSS equivalent of this color.518 *519 * @see {@link http://www.w3.org/TR/css3-color/#rgba-color|CSS RGB or RGBA color values}520 */521 Color.prototype.toCssColorString = function() {522 var red = Color.floatToByte(this.red);523 var green = Color.floatToByte(this.green);524 var blue = Color.floatToByte(this.blue);525 if (this.alpha === 1) {526 return 'rgb(' + red + ',' + green + ',' + blue + ')';527 }528 return 'rgba(' + red + ',' + green + ',' + blue + ',' + this.alpha + ')';529 };530 /**531 * Converts this color to an array of red, green, blue, and alpha values532 * that are in the range of 0 to 255.533 *534 * @param {Number[]} [result] The array to store the result in, if undefined a new instance will be created.535 * @returns {Number[]} The modified result parameter or a new instance if result was undefined.536 */537 Color.prototype.toBytes = function(result) {538 var red = Color.floatToByte(this.red);539 var green = Color.floatToByte(this.green);540 var blue = Color.floatToByte(this.blue);541 var alpha = Color.floatToByte(this.alpha);542 if (!defined(result)) {543 return [red, green, blue, alpha];544 }545 result[0] = red;546 result[1] = green;547 result[2] = blue;548 result[3] = alpha;549 return result;550 };551 /**552 * Converts this color to a single numeric unsigned 32-bit RGBA value, using the endianness553 * of the system.554 *555 * @returns {Number} A single numeric unsigned 32-bit RGBA value.556 *557 *558 * @example559 * var rgba = Cesium.Color.BLUE.toRgba();560 *561 * @see Color.fromRgba562 */563 Color.prototype.toRgba = function() {564 // scratchUint32Array and scratchUint8Array share an underlying array buffer565 scratchUint8Array[0] = Color.floatToByte(this.red);566 scratchUint8Array[1] = Color.floatToByte(this.green);567 scratchUint8Array[2] = Color.floatToByte(this.blue);568 scratchUint8Array[3] = Color.floatToByte(this.alpha);569 return scratchUint32Array[0];570 };571 /**572 * Brightens this color by the provided magnitude.573 *574 * @param {Number} magnitude A positive number indicating the amount to brighten.575 * @param {Color} result The object onto which to store the result.576 * @returns {Color} The modified result parameter.577 *578 * @example579 * var brightBlue = Cesium.Color.BLUE.brighten(0.5, new Cesium.Color());580 */581 Color.prototype.brighten = function(magnitude, result) {582 //>>includeStart('debug', pragmas.debug);583 Check.typeOf.number('magnitude', magnitude);584 Check.typeOf.number.greaterThanOrEquals('magnitude', magnitude, 0.0);585 Check.typeOf.object('result', result);586 //>>includeEnd('debug');587 magnitude = (1.0 - magnitude);588 result.red = 1.0 - ((1.0 - this.red) * magnitude);589 result.green = 1.0 - ((1.0 - this.green) * magnitude);590 result.blue = 1.0 - ((1.0 - this.blue) * magnitude);591 result.alpha = this.alpha;592 return result;593 };594 /**595 * Darkens this color by the provided magnitude.596 *597 * @param {Number} magnitude A positive number indicating the amount to darken.598 * @param {Color} result The object onto which to store the result.599 * @returns {Color} The modified result parameter.600 *601 * @example602 * var darkBlue = Cesium.Color.BLUE.darken(0.5, new Cesium.Color());603 */604 Color.prototype.darken = function(magnitude, result) {605 //>>includeStart('debug', pragmas.debug);606 Check.typeOf.number('magnitude', magnitude);607 Check.typeOf.number.greaterThanOrEquals('magnitude', magnitude, 0.0);608 Check.typeOf.object('result', result);609 //>>includeEnd('debug');610 magnitude = (1.0 - magnitude);611 result.red = this.red * magnitude;612 result.green = this.green * magnitude;613 result.blue = this.blue * magnitude;614 result.alpha = this.alpha;615 return result;616 };617 /**618 * Creates a new Color that has the same red, green, and blue components619 * as this Color, but with the specified alpha value.620 *621 * @param {Number} alpha The new alpha component.622 * @param {Color} [result] The object onto which to store the result.623 * @returns {Color} The modified result parameter or a new Color instance if one was not provided.624 *625 * @example var translucentRed = Cesium.Color.RED.withAlpha(0.9);626 */627 Color.prototype.withAlpha = function(alpha, result) {628 return Color.fromAlpha(this, alpha, result);629 };630 /**631 * Computes the componentwise sum of two Colors.632 *633 * @param {Color} left The first Color.634 * @param {Color} right The second Color.635 * @param {Color} result The object onto which to store the result.636 * @returns {Color} The modified result parameter.637 */638 Color.add = function(left, right, result) {639 //>>includeStart('debug', pragmas.debug);640 Check.typeOf.object('left', left);641 Check.typeOf.object('right', right);642 Check.typeOf.object('result', result);643 //>>includeEnd('debug');644 result.red = left.red + right.red;645 result.green = left.green + right.green;646 result.blue = left.blue + right.blue;647 result.alpha = left.alpha + right.alpha;648 return result;649 };650 /**651 * Computes the componentwise difference of two Colors.652 *653 * @param {Color} left The first Color.654 * @param {Color} right The second Color.655 * @param {Color} result The object onto which to store the result.656 * @returns {Color} The modified result parameter.657 */658 Color.subtract = function(left, right, result) {659 //>>includeStart('debug', pragmas.debug);660 Check.typeOf.object('left', left);661 Check.typeOf.object('right', right);662 Check.typeOf.object('result', result);663 //>>includeEnd('debug');664 result.red = left.red - right.red;665 result.green = left.green - right.green;666 result.blue = left.blue - right.blue;667 result.alpha = left.alpha - right.alpha;668 return result;669 };670 /**671 * Computes the componentwise product of two Colors.672 *673 * @param {Color} left The first Color.674 * @param {Color} right The second Color.675 * @param {Color} result The object onto which to store the result.676 * @returns {Color} The modified result parameter.677 */678 Color.multiply = function(left, right, result) {679 //>>includeStart('debug', pragmas.debug);680 Check.typeOf.object('left', left);681 Check.typeOf.object('right', right);682 Check.typeOf.object('result', result);683 //>>includeEnd('debug');684 result.red = left.red * right.red;685 result.green = left.green * right.green;686 result.blue = left.blue * right.blue;687 result.alpha = left.alpha * right.alpha;688 return result;689 };690 /**691 * Computes the componentwise quotient of two Colors.692 *693 * @param {Color} left The first Color.694 * @param {Color} right The second Color.695 * @param {Color} result The object onto which to store the result.696 * @returns {Color} The modified result parameter.697 */698 Color.divide = function(left, right, result) {699 //>>includeStart('debug', pragmas.debug);700 Check.typeOf.object('left', left);701 Check.typeOf.object('right', right);702 Check.typeOf.object('result', result);703 //>>includeEnd('debug');704 result.red = left.red / right.red;705 result.green = left.green / right.green;706 result.blue = left.blue / right.blue;707 result.alpha = left.alpha / right.alpha;708 return result;709 };710 /**711 * Computes the componentwise modulus of two Colors.712 *713 * @param {Color} left The first Color.714 * @param {Color} right The second Color.715 * @param {Color} result The object onto which to store the result.716 * @returns {Color} The modified result parameter.717 */718 Color.mod = function(left, right, result) {719 //>>includeStart('debug', pragmas.debug);720 Check.typeOf.object('left', left);721 Check.typeOf.object('right', right);722 Check.typeOf.object('result', result);723 //>>includeEnd('debug');724 result.red = left.red % right.red;725 result.green = left.green % right.green;726 result.blue = left.blue % right.blue;727 result.alpha = left.alpha % right.alpha;728 return result;729 };730 /**731 * Computes the linear interpolation or extrapolation at t between the provided colors.732 *733 * @param {Color} start The color corresponding to t at 0.0.734 * @param {Color} end The color corresponding to t at 1.0.735 * @param {Number} t The point along t at which to interpolate.736 * @param {Color} result The object onto which to store the result.737 * @returns {Color} The modified result parameter.738 */739 Color.lerp = function(start, end, t, result) {740 //>>includeStart('debug', pragmas.debug);741 Check.typeOf.object('start', start);742 Check.typeOf.object('end', end);743 Check.typeOf.number('t', t);744 Check.typeOf.object('result', result);745 //>>includeEnd('debug');746 result.red = CesiumMath.lerp(start.red, end.red, t);747 result.green = CesiumMath.lerp(start.green, end.green, t);748 result.blue = CesiumMath.lerp(start.blue, end.blue, t);749 result.alpha = CesiumMath.lerp(start.alpha, end.alpha, t);750 return result;751 };752 /**753 * Multiplies the provided Color componentwise by the provided scalar.754 *755 * @param {Color} color The Color to be scaled.756 * @param {Number} scalar The scalar to multiply with.757 * @param {Color} result The object onto which to store the result.758 * @returns {Color} The modified result parameter.759 */760 Color.multiplyByScalar = function(color, scalar, result) {761 //>>includeStart('debug', pragmas.debug);762 Check.typeOf.object('color', color);763 Check.typeOf.number('scalar', scalar);764 Check.typeOf.object('result', result);765 //>>includeEnd('debug');766 result.red = color.red * scalar;767 result.green = color.green * scalar;768 result.blue = color.blue * scalar;769 result.alpha = color.alpha * scalar;770 return result;771 };772 /**773 * Divides the provided Color componentwise by the provided scalar.774 *775 * @param {Color} color The Color to be divided.776 * @param {Number} scalar The scalar to divide with.777 * @param {Color} result The object onto which to store the result.778 * @returns {Color} The modified result parameter.779 */780 Color.divideByScalar = function(color, scalar, result) {781 //>>includeStart('debug', pragmas.debug);782 Check.typeOf.object('color', color);783 Check.typeOf.number('scalar', scalar);784 Check.typeOf.object('result', result);785 //>>includeEnd('debug');786 result.red = color.red / scalar;787 result.green = color.green / scalar;788 result.blue = color.blue / scalar;789 result.alpha = color.alpha / scalar;790 return result;791 };792 /**793 * An immutable Color instance initialized to CSS color #F0F8FF794 * <span class="colorSwath" style="background: #F0F8FF;"></span>795 *796 * @constant797 * @type {Color}798 */799 Color.ALICEBLUE = Object.freeze(Color.fromCssColorString('#F0F8FF'));800 /**801 * An immutable Color instance initialized to CSS color #FAEBD7802 * <span class="colorSwath" style="background: #FAEBD7;"></span>803 *804 * @constant805 * @type {Color}806 */807 Color.ANTIQUEWHITE = Object.freeze(Color.fromCssColorString('#FAEBD7'));808 /**809 * An immutable Color instance initialized to CSS color #00FFFF810 * <span class="colorSwath" style="background: #00FFFF;"></span>811 *812 * @constant813 * @type {Color}814 */815 Color.AQUA = Object.freeze(Color.fromCssColorString('#00FFFF'));816 /**817 * An immutable Color instance initialized to CSS color #7FFFD4818 * <span class="colorSwath" style="background: #7FFFD4;"></span>819 *820 * @constant821 * @type {Color}822 */823 Color.AQUAMARINE = Object.freeze(Color.fromCssColorString('#7FFFD4'));824 /**825 * An immutable Color instance initialized to CSS color #F0FFFF826 * <span class="colorSwath" style="background: #F0FFFF;"></span>827 *828 * @constant829 * @type {Color}830 */831 Color.AZURE = Object.freeze(Color.fromCssColorString('#F0FFFF'));832 /**833 * An immutable Color instance initialized to CSS color #F5F5DC834 * <span class="colorSwath" style="background: #F5F5DC;"></span>835 *836 * @constant837 * @type {Color}838 */839 Color.BEIGE = Object.freeze(Color.fromCssColorString('#F5F5DC'));840 /**841 * An immutable Color instance initialized to CSS color #FFE4C4842 * <span class="colorSwath" style="background: #FFE4C4;"></span>843 *844 * @constant845 * @type {Color}846 */847 Color.BISQUE = Object.freeze(Color.fromCssColorString('#FFE4C4'));848 /**849 * An immutable Color instance initialized to CSS color #000000850 * <span class="colorSwath" style="background: #000000;"></span>851 *852 * @constant853 * @type {Color}854 */855 Color.BLACK = Object.freeze(Color.fromCssColorString('#000000'));856 /**857 * An immutable Color instance initialized to CSS color #FFEBCD858 * <span class="colorSwath" style="background: #FFEBCD;"></span>859 *860 * @constant861 * @type {Color}862 */863 Color.BLANCHEDALMOND = Object.freeze(Color.fromCssColorString('#FFEBCD'));864 /**865 * An immutable Color instance initialized to CSS color #0000FF866 * <span class="colorSwath" style="background: #0000FF;"></span>867 *868 * @constant869 * @type {Color}870 */871 Color.BLUE = Object.freeze(Color.fromCssColorString('#0000FF'));872 /**873 * An immutable Color instance initialized to CSS color #8A2BE2874 * <span class="colorSwath" style="background: #8A2BE2;"></span>875 *876 * @constant877 * @type {Color}878 */879 Color.BLUEVIOLET = Object.freeze(Color.fromCssColorString('#8A2BE2'));880 /**881 * An immutable Color instance initialized to CSS color #A52A2A882 * <span class="colorSwath" style="background: #A52A2A;"></span>883 *884 * @constant885 * @type {Color}886 */887 Color.BROWN = Object.freeze(Color.fromCssColorString('#A52A2A'));888 /**889 * An immutable Color instance initialized to CSS color #DEB887890 * <span class="colorSwath" style="background: #DEB887;"></span>891 *892 * @constant893 * @type {Color}894 */895 Color.BURLYWOOD = Object.freeze(Color.fromCssColorString('#DEB887'));896 /**897 * An immutable Color instance initialized to CSS color #5F9EA0898 * <span class="colorSwath" style="background: #5F9EA0;"></span>899 *900 * @constant901 * @type {Color}902 */903 Color.CADETBLUE = Object.freeze(Color.fromCssColorString('#5F9EA0'));904 /**905 * An immutable Color instance initialized to CSS color #7FFF00906 * <span class="colorSwath" style="background: #7FFF00;"></span>907 *908 * @constant909 * @type {Color}910 */911 Color.CHARTREUSE = Object.freeze(Color.fromCssColorString('#7FFF00'));912 /**913 * An immutable Color instance initialized to CSS color #D2691E914 * <span class="colorSwath" style="background: #D2691E;"></span>915 *916 * @constant917 * @type {Color}918 */919 Color.CHOCOLATE = Object.freeze(Color.fromCssColorString('#D2691E'));920 /**921 * An immutable Color instance initialized to CSS color #FF7F50922 * <span class="colorSwath" style="background: #FF7F50;"></span>923 *924 * @constant925 * @type {Color}926 */927 Color.CORAL = Object.freeze(Color.fromCssColorString('#FF7F50'));928 /**929 * An immutable Color instance initialized to CSS color #6495ED930 * <span class="colorSwath" style="background: #6495ED;"></span>931 *932 * @constant933 * @type {Color}934 */935 Color.CORNFLOWERBLUE = Object.freeze(Color.fromCssColorString('#6495ED'));936 /**937 * An immutable Color instance initialized to CSS color #FFF8DC938 * <span class="colorSwath" style="background: #FFF8DC;"></span>939 *940 * @constant941 * @type {Color}942 */943 Color.CORNSILK = Object.freeze(Color.fromCssColorString('#FFF8DC'));944 /**945 * An immutable Color instance initialized to CSS color #DC143C946 * <span class="colorSwath" style="background: #DC143C;"></span>947 *948 * @constant949 * @type {Color}950 */951 Color.CRIMSON = Object.freeze(Color.fromCssColorString('#DC143C'));952 /**953 * An immutable Color instance initialized to CSS color #00FFFF954 * <span class="colorSwath" style="background: #00FFFF;"></span>955 *956 * @constant957 * @type {Color}958 */959 Color.CYAN = Object.freeze(Color.fromCssColorString('#00FFFF'));960 /**961 * An immutable Color instance initialized to CSS color #00008B962 * <span class="colorSwath" style="background: #00008B;"></span>963 *964 * @constant965 * @type {Color}966 */967 Color.DARKBLUE = Object.freeze(Color.fromCssColorString('#00008B'));968 /**969 * An immutable Color instance initialized to CSS color #008B8B970 * <span class="colorSwath" style="background: #008B8B;"></span>971 *972 * @constant973 * @type {Color}974 */975 Color.DARKCYAN = Object.freeze(Color.fromCssColorString('#008B8B'));976 /**977 * An immutable Color instance initialized to CSS color #B8860B978 * <span class="colorSwath" style="background: #B8860B;"></span>979 *980 * @constant981 * @type {Color}982 */983 Color.DARKGOLDENROD = Object.freeze(Color.fromCssColorString('#B8860B'));984 /**985 * An immutable Color instance initialized to CSS color #A9A9A9986 * <span class="colorSwath" style="background: #A9A9A9;"></span>987 *988 * @constant989 * @type {Color}990 */991 Color.DARKGRAY = Object.freeze(Color.fromCssColorString('#A9A9A9'));992 /**993 * An immutable Color instance initialized to CSS color #006400994 * <span class="colorSwath" style="background: #006400;"></span>995 *996 * @constant997 * @type {Color}998 */999 Color.DARKGREEN = Object.freeze(Color.fromCssColorString('#006400'));1000 /**1001 * An immutable Color instance initialized to CSS color #A9A9A91002 * <span class="colorSwath" style="background: #A9A9A9;"></span>1003 *1004 * @constant1005 * @type {Color}1006 */1007 Color.DARKGREY = Color.DARKGRAY;1008 /**1009 * An immutable Color instance initialized to CSS color #BDB76B1010 * <span class="colorSwath" style="background: #BDB76B;"></span>1011 *1012 * @constant1013 * @type {Color}1014 */1015 Color.DARKKHAKI = Object.freeze(Color.fromCssColorString('#BDB76B'));1016 /**1017 * An immutable Color instance initialized to CSS color #8B008B1018 * <span class="colorSwath" style="background: #8B008B;"></span>1019 *1020 * @constant1021 * @type {Color}1022 */1023 Color.DARKMAGENTA = Object.freeze(Color.fromCssColorString('#8B008B'));1024 /**1025 * An immutable Color instance initialized to CSS color #556B2F1026 * <span class="colorSwath" style="background: #556B2F;"></span>1027 *1028 * @constant1029 * @type {Color}1030 */1031 Color.DARKOLIVEGREEN = Object.freeze(Color.fromCssColorString('#556B2F'));1032 /**1033 * An immutable Color instance initialized to CSS color #FF8C001034 * <span class="colorSwath" style="background: #FF8C00;"></span>1035 *1036 * @constant1037 * @type {Color}1038 */1039 Color.DARKORANGE = Object.freeze(Color.fromCssColorString('#FF8C00'));1040 /**1041 * An immutable Color instance initialized to CSS color #9932CC1042 * <span class="colorSwath" style="background: #9932CC;"></span>1043 *1044 * @constant1045 * @type {Color}1046 */1047 Color.DARKORCHID = Object.freeze(Color.fromCssColorString('#9932CC'));1048 /**1049 * An immutable Color instance initialized to CSS color #8B00001050 * <span class="colorSwath" style="background: #8B0000;"></span>1051 *1052 * @constant1053 * @type {Color}1054 */1055 Color.DARKRED = Object.freeze(Color.fromCssColorString('#8B0000'));1056 /**1057 * An immutable Color instance initialized to CSS color #E9967A1058 * <span class="colorSwath" style="background: #E9967A;"></span>1059 *1060 * @constant1061 * @type {Color}1062 */1063 Color.DARKSALMON = Object.freeze(Color.fromCssColorString('#E9967A'));1064 /**1065 * An immutable Color instance initialized to CSS color #8FBC8F1066 * <span class="colorSwath" style="background: #8FBC8F;"></span>1067 *1068 * @constant1069 * @type {Color}1070 */1071 Color.DARKSEAGREEN = Object.freeze(Color.fromCssColorString('#8FBC8F'));1072 /**1073 * An immutable Color instance initialized to CSS color #483D8B1074 * <span class="colorSwath" style="background: #483D8B;"></span>1075 *1076 * @constant1077 * @type {Color}1078 */1079 Color.DARKSLATEBLUE = Object.freeze(Color.fromCssColorString('#483D8B'));1080 /**1081 * An immutable Color instance initialized to CSS color #2F4F4F1082 * <span class="colorSwath" style="background: #2F4F4F;"></span>1083 *1084 * @constant1085 * @type {Color}1086 */1087 Color.DARKSLATEGRAY = Object.freeze(Color.fromCssColorString('#2F4F4F'));1088 /**1089 * An immutable Color instance initialized to CSS color #2F4F4F1090 * <span class="colorSwath" style="background: #2F4F4F;"></span>1091 *1092 * @constant1093 * @type {Color}1094 */1095 Color.DARKSLATEGREY = Color.DARKSLATEGRAY;1096 /**1097 * An immutable Color instance initialized to CSS color #00CED11098 * <span class="colorSwath" style="background: #00CED1;"></span>1099 *1100 * @constant1101 * @type {Color}1102 */1103 Color.DARKTURQUOISE = Object.freeze(Color.fromCssColorString('#00CED1'));1104 /**1105 * An immutable Color instance initialized to CSS color #9400D31106 * <span class="colorSwath" style="background: #9400D3;"></span>1107 *1108 * @constant1109 * @type {Color}1110 */1111 Color.DARKVIOLET = Object.freeze(Color.fromCssColorString('#9400D3'));1112 /**1113 * An immutable Color instance initialized to CSS color #FF14931114 * <span class="colorSwath" style="background: #FF1493;"></span>1115 *1116 * @constant1117 * @type {Color}1118 */1119 Color.DEEPPINK = Object.freeze(Color.fromCssColorString('#FF1493'));1120 /**1121 * An immutable Color instance initialized to CSS color #00BFFF1122 * <span class="colorSwath" style="background: #00BFFF;"></span>1123 *1124 * @constant1125 * @type {Color}1126 */1127 Color.DEEPSKYBLUE = Object.freeze(Color.fromCssColorString('#00BFFF'));1128 /**1129 * An immutable Color instance initialized to CSS color #6969691130 * <span class="colorSwath" style="background: #696969;"></span>1131 *1132 * @constant1133 * @type {Color}1134 */1135 Color.DIMGRAY = Object.freeze(Color.fromCssColorString('#696969'));1136 /**1137 * An immutable Color instance initialized to CSS color #6969691138 * <span class="colorSwath" style="background: #696969;"></span>1139 *1140 * @constant1141 * @type {Color}1142 */1143 Color.DIMGREY = Color.DIMGRAY;1144 /**1145 * An immutable Color instance initialized to CSS color #1E90FF1146 * <span class="colorSwath" style="background: #1E90FF;"></span>1147 *1148 * @constant1149 * @type {Color}1150 */1151 Color.DODGERBLUE = Object.freeze(Color.fromCssColorString('#1E90FF'));1152 /**1153 * An immutable Color instance initialized to CSS color #B222221154 * <span class="colorSwath" style="background: #B22222;"></span>1155 *1156 * @constant1157 * @type {Color}1158 */1159 Color.FIREBRICK = Object.freeze(Color.fromCssColorString('#B22222'));1160 /**1161 * An immutable Color instance initialized to CSS color #FFFAF01162 * <span class="colorSwath" style="background: #FFFAF0;"></span>1163 *1164 * @constant1165 * @type {Color}1166 */1167 Color.FLORALWHITE = Object.freeze(Color.fromCssColorString('#FFFAF0'));1168 /**1169 * An immutable Color instance initialized to CSS color #228B221170 * <span class="colorSwath" style="background: #228B22;"></span>1171 *1172 * @constant1173 * @type {Color}1174 */1175 Color.FORESTGREEN = Object.freeze(Color.fromCssColorString('#228B22'));1176 /**1177 * An immutable Color instance initialized to CSS color #FF00FF1178 * <span class="colorSwath" style="background: #FF00FF;"></span>1179 *1180 * @constant1181 * @type {Color}1182 */1183 Color.FUCHSIA = Object.freeze(Color.fromCssColorString('#FF00FF'));1184 /**1185 * An immutable Color instance initialized to CSS color #DCDCDC1186 * <span class="colorSwath" style="background: #DCDCDC;"></span>1187 *1188 * @constant1189 * @type {Color}1190 */1191 Color.GAINSBORO = Object.freeze(Color.fromCssColorString('#DCDCDC'));1192 /**1193 * An immutable Color instance initialized to CSS color #F8F8FF1194 * <span class="colorSwath" style="background: #F8F8FF;"></span>1195 *1196 * @constant1197 * @type {Color}1198 */1199 Color.GHOSTWHITE = Object.freeze(Color.fromCssColorString('#F8F8FF'));1200 /**1201 * An immutable Color instance initialized to CSS color #FFD7001202 * <span class="colorSwath" style="background: #FFD700;"></span>1203 *1204 * @constant1205 * @type {Color}1206 */1207 Color.GOLD = Object.freeze(Color.fromCssColorString('#FFD700'));1208 /**1209 * An immutable Color instance initialized to CSS color #DAA5201210 * <span class="colorSwath" style="background: #DAA520;"></span>1211 *1212 * @constant1213 * @type {Color}1214 */1215 Color.GOLDENROD = Object.freeze(Color.fromCssColorString('#DAA520'));1216 /**1217 * An immutable Color instance initialized to CSS color #8080801218 * <span class="colorSwath" style="background: #808080;"></span>1219 *1220 * @constant1221 * @type {Color}1222 */1223 Color.GRAY = Object.freeze(Color.fromCssColorString('#808080'));1224 /**1225 * An immutable Color instance initialized to CSS color #0080001226 * <span class="colorSwath" style="background: #008000;"></span>1227 *1228 * @constant1229 * @type {Color}1230 */1231 Color.GREEN = Object.freeze(Color.fromCssColorString('#008000'));1232 /**1233 * An immutable Color instance initialized to CSS color #ADFF2F1234 * <span class="colorSwath" style="background: #ADFF2F;"></span>1235 *1236 * @constant1237 * @type {Color}1238 */1239 Color.GREENYELLOW = Object.freeze(Color.fromCssColorString('#ADFF2F'));1240 /**1241 * An immutable Color instance initialized to CSS color #8080801242 * <span class="colorSwath" style="background: #808080;"></span>1243 *1244 * @constant1245 * @type {Color}1246 */1247 Color.GREY = Color.GRAY;1248 /**1249 * An immutable Color instance initialized to CSS color #F0FFF01250 * <span class="colorSwath" style="background: #F0FFF0;"></span>1251 *1252 * @constant1253 * @type {Color}1254 */1255 Color.HONEYDEW = Object.freeze(Color.fromCssColorString('#F0FFF0'));1256 /**1257 * An immutable Color instance initialized to CSS color #FF69B41258 * <span class="colorSwath" style="background: #FF69B4;"></span>1259 *1260 * @constant1261 * @type {Color}1262 */1263 Color.HOTPINK = Object.freeze(Color.fromCssColorString('#FF69B4'));1264 /**1265 * An immutable Color instance initialized to CSS color #CD5C5C1266 * <span class="colorSwath" style="background: #CD5C5C;"></span>1267 *1268 * @constant1269 * @type {Color}1270 */1271 Color.INDIANRED = Object.freeze(Color.fromCssColorString('#CD5C5C'));1272 /**1273 * An immutable Color instance initialized to CSS color #4B00821274 * <span class="colorSwath" style="background: #4B0082;"></span>1275 *1276 * @constant1277 * @type {Color}1278 */1279 Color.INDIGO = Object.freeze(Color.fromCssColorString('#4B0082'));1280 /**1281 * An immutable Color instance initialized to CSS color #FFFFF01282 * <span class="colorSwath" style="background: #FFFFF0;"></span>1283 *1284 * @constant1285 * @type {Color}1286 */1287 Color.IVORY = Object.freeze(Color.fromCssColorString('#FFFFF0'));1288 /**1289 * An immutable Color instance initialized to CSS color #F0E68C1290 * <span class="colorSwath" style="background: #F0E68C;"></span>1291 *1292 * @constant1293 * @type {Color}1294 */1295 Color.KHAKI = Object.freeze(Color.fromCssColorString('#F0E68C'));1296 /**1297 * An immutable Color instance initialized to CSS color #E6E6FA1298 * <span class="colorSwath" style="background: #E6E6FA;"></span>1299 *1300 * @constant1301 * @type {Color}1302 */1303 Color.LAVENDER = Object.freeze(Color.fromCssColorString('#E6E6FA'));1304 /**1305 * An immutable Color instance initialized to CSS color #FFF0F51306 * <span class="colorSwath" style="background: #FFF0F5;"></span>1307 *1308 * @constant1309 * @type {Color}1310 */1311 Color.LAVENDAR_BLUSH = Object.freeze(Color.fromCssColorString('#FFF0F5'));1312 /**1313 * An immutable Color instance initialized to CSS color #7CFC001314 * <span class="colorSwath" style="background: #7CFC00;"></span>1315 *1316 * @constant1317 * @type {Color}1318 */1319 Color.LAWNGREEN = Object.freeze(Color.fromCssColorString('#7CFC00'));1320 /**1321 * An immutable Color instance initialized to CSS color #FFFACD1322 * <span class="colorSwath" style="background: #FFFACD;"></span>1323 *1324 * @constant1325 * @type {Color}1326 */1327 Color.LEMONCHIFFON = Object.freeze(Color.fromCssColorString('#FFFACD'));1328 /**1329 * An immutable Color instance initialized to CSS color #ADD8E61330 * <span class="colorSwath" style="background: #ADD8E6;"></span>1331 *1332 * @constant1333 * @type {Color}1334 */1335 Color.LIGHTBLUE = Object.freeze(Color.fromCssColorString('#ADD8E6'));1336 /**1337 * An immutable Color instance initialized to CSS color #F080801338 * <span class="colorSwath" style="background: #F08080;"></span>1339 *1340 * @constant1341 * @type {Color}1342 */1343 Color.LIGHTCORAL = Object.freeze(Color.fromCssColorString('#F08080'));1344 /**1345 * An immutable Color instance initialized to CSS color #E0FFFF1346 * <span class="colorSwath" style="background: #E0FFFF;"></span>1347 *1348 * @constant1349 * @type {Color}1350 */1351 Color.LIGHTCYAN = Object.freeze(Color.fromCssColorString('#E0FFFF'));1352 /**1353 * An immutable Color instance initialized to CSS color #FAFAD21354 * <span class="colorSwath" style="background: #FAFAD2;"></span>1355 *1356 * @constant1357 * @type {Color}1358 */1359 Color.LIGHTGOLDENRODYELLOW = Object.freeze(Color.fromCssColorString('#FAFAD2'));1360 /**1361 * An immutable Color instance initialized to CSS color #D3D3D31362 * <span class="colorSwath" style="background: #D3D3D3;"></span>1363 *1364 * @constant1365 * @type {Color}1366 */1367 Color.LIGHTGRAY = Object.freeze(Color.fromCssColorString('#D3D3D3'));1368 /**1369 * An immutable Color instance initialized to CSS color #90EE901370 * <span class="colorSwath" style="background: #90EE90;"></span>1371 *1372 * @constant1373 * @type {Color}1374 */1375 Color.LIGHTGREEN = Object.freeze(Color.fromCssColorString('#90EE90'));1376 /**1377 * An immutable Color instance initialized to CSS color #D3D3D31378 * <span class="colorSwath" style="background: #D3D3D3;"></span>1379 *1380 * @constant1381 * @type {Color}1382 */1383 Color.LIGHTGREY = Color.LIGHTGRAY;1384 /**1385 * An immutable Color instance initialized to CSS color #FFB6C11386 * <span class="colorSwath" style="background: #FFB6C1;"></span>1387 *1388 * @constant1389 * @type {Color}1390 */1391 Color.LIGHTPINK = Object.freeze(Color.fromCssColorString('#FFB6C1'));1392 /**1393 * An immutable Color instance initialized to CSS color #20B2AA1394 * <span class="colorSwath" style="background: #20B2AA;"></span>1395 *1396 * @constant1397 * @type {Color}1398 */1399 Color.LIGHTSEAGREEN = Object.freeze(Color.fromCssColorString('#20B2AA'));1400 /**1401 * An immutable Color instance initialized to CSS color #87CEFA1402 * <span class="colorSwath" style="background: #87CEFA;"></span>1403 *1404 * @constant1405 * @type {Color}1406 */1407 Color.LIGHTSKYBLUE = Object.freeze(Color.fromCssColorString('#87CEFA'));1408 /**1409 * An immutable Color instance initialized to CSS color #7788991410 * <span class="colorSwath" style="background: #778899;"></span>1411 *1412 * @constant1413 * @type {Color}1414 */1415 Color.LIGHTSLATEGRAY = Object.freeze(Color.fromCssColorString('#778899'));1416 /**1417 * An immutable Color instance initialized to CSS color #7788991418 * <span class="colorSwath" style="background: #778899;"></span>1419 *1420 * @constant1421 * @type {Color}1422 */1423 Color.LIGHTSLATEGREY = Color.LIGHTSLATEGRAY;1424 /**1425 * An immutable Color instance initialized to CSS color #B0C4DE1426 * <span class="colorSwath" style="background: #B0C4DE;"></span>1427 *1428 * @constant1429 * @type {Color}1430 */1431 Color.LIGHTSTEELBLUE = Object.freeze(Color.fromCssColorString('#B0C4DE'));1432 /**1433 * An immutable Color instance initialized to CSS color #FFFFE01434 * <span class="colorSwath" style="background: #FFFFE0;"></span>1435 *1436 * @constant1437 * @type {Color}1438 */1439 Color.LIGHTYELLOW = Object.freeze(Color.fromCssColorString('#FFFFE0'));1440 /**1441 * An immutable Color instance initialized to CSS color #00FF001442 * <span class="colorSwath" style="background: #00FF00;"></span>1443 *1444 * @constant1445 * @type {Color}1446 */1447 Color.LIME = Object.freeze(Color.fromCssColorString('#00FF00'));1448 /**1449 * An immutable Color instance initialized to CSS color #32CD321450 * <span class="colorSwath" style="background: #32CD32;"></span>1451 *1452 * @constant1453 * @type {Color}1454 */1455 Color.LIMEGREEN = Object.freeze(Color.fromCssColorString('#32CD32'));1456 /**1457 * An immutable Color instance initialized to CSS color #FAF0E61458 * <span class="colorSwath" style="background: #FAF0E6;"></span>1459 *1460 * @constant1461 * @type {Color}1462 */1463 Color.LINEN = Object.freeze(Color.fromCssColorString('#FAF0E6'));1464 /**1465 * An immutable Color instance initialized to CSS color #FF00FF1466 * <span class="colorSwath" style="background: #FF00FF;"></span>1467 *1468 * @constant1469 * @type {Color}1470 */1471 Color.MAGENTA = Object.freeze(Color.fromCssColorString('#FF00FF'));1472 /**1473 * An immutable Color instance initialized to CSS color #8000001474 * <span class="colorSwath" style="background: #800000;"></span>1475 *1476 * @constant1477 * @type {Color}1478 */1479 Color.MAROON = Object.freeze(Color.fromCssColorString('#800000'));1480 /**1481 * An immutable Color instance initialized to CSS color #66CDAA1482 * <span class="colorSwath" style="background: #66CDAA;"></span>1483 *1484 * @constant1485 * @type {Color}1486 */1487 Color.MEDIUMAQUAMARINE = Object.freeze(Color.fromCssColorString('#66CDAA'));1488 /**1489 * An immutable Color instance initialized to CSS color #0000CD1490 * <span class="colorSwath" style="background: #0000CD;"></span>1491 *1492 * @constant1493 * @type {Color}1494 */1495 Color.MEDIUMBLUE = Object.freeze(Color.fromCssColorString('#0000CD'));1496 /**1497 * An immutable Color instance initialized to CSS color #BA55D31498 * <span class="colorSwath" style="background: #BA55D3;"></span>1499 *1500 * @constant1501 * @type {Color}1502 */1503 Color.MEDIUMORCHID = Object.freeze(Color.fromCssColorString('#BA55D3'));1504 /**1505 * An immutable Color instance initialized to CSS color #9370DB1506 * <span class="colorSwath" style="background: #9370DB;"></span>1507 *1508 * @constant1509 * @type {Color}1510 */1511 Color.MEDIUMPURPLE = Object.freeze(Color.fromCssColorString('#9370DB'));1512 /**1513 * An immutable Color instance initialized to CSS color #3CB3711514 * <span class="colorSwath" style="background: #3CB371;"></span>1515 *1516 * @constant1517 * @type {Color}1518 */1519 Color.MEDIUMSEAGREEN = Object.freeze(Color.fromCssColorString('#3CB371'));1520 /**1521 * An immutable Color instance initialized to CSS color #7B68EE1522 * <span class="colorSwath" style="background: #7B68EE;"></span>1523 *1524 * @constant1525 * @type {Color}1526 */1527 Color.MEDIUMSLATEBLUE = Object.freeze(Color.fromCssColorString('#7B68EE'));1528 /**1529 * An immutable Color instance initialized to CSS color #00FA9A1530 * <span class="colorSwath" style="background: #00FA9A;"></span>1531 *1532 * @constant1533 * @type {Color}1534 */1535 Color.MEDIUMSPRINGGREEN = Object.freeze(Color.fromCssColorString('#00FA9A'));1536 /**1537 * An immutable Color instance initialized to CSS color #48D1CC1538 * <span class="colorSwath" style="background: #48D1CC;"></span>1539 *1540 * @constant1541 * @type {Color}1542 */1543 Color.MEDIUMTURQUOISE = Object.freeze(Color.fromCssColorString('#48D1CC'));1544 /**1545 * An immutable Color instance initialized to CSS color #C715851546 * <span class="colorSwath" style="background: #C71585;"></span>1547 *1548 * @constant1549 * @type {Color}1550 */1551 Color.MEDIUMVIOLETRED = Object.freeze(Color.fromCssColorString('#C71585'));1552 /**1553 * An immutable Color instance initialized to CSS color #1919701554 * <span class="colorSwath" style="background: #191970;"></span>1555 *1556 * @constant1557 * @type {Color}1558 */1559 Color.MIDNIGHTBLUE = Object.freeze(Color.fromCssColorString('#191970'));1560 /**1561 * An immutable Color instance initialized to CSS color #F5FFFA1562 * <span class="colorSwath" style="background: #F5FFFA;"></span>1563 *1564 * @constant1565 * @type {Color}1566 */1567 Color.MINTCREAM = Object.freeze(Color.fromCssColorString('#F5FFFA'));1568 /**1569 * An immutable Color instance initialized to CSS color #FFE4E11570 * <span class="colorSwath" style="background: #FFE4E1;"></span>1571 *1572 * @constant1573 * @type {Color}1574 */1575 Color.MISTYROSE = Object.freeze(Color.fromCssColorString('#FFE4E1'));1576 /**1577 * An immutable Color instance initialized to CSS color #FFE4B51578 * <span class="colorSwath" style="background: #FFE4B5;"></span>1579 *1580 * @constant1581 * @type {Color}1582 */1583 Color.MOCCASIN = Object.freeze(Color.fromCssColorString('#FFE4B5'));1584 /**1585 * An immutable Color instance initialized to CSS color #FFDEAD1586 * <span class="colorSwath" style="background: #FFDEAD;"></span>1587 *1588 * @constant1589 * @type {Color}1590 */1591 Color.NAVAJOWHITE = Object.freeze(Color.fromCssColorString('#FFDEAD'));1592 /**1593 * An immutable Color instance initialized to CSS color #0000801594 * <span class="colorSwath" style="background: #000080;"></span>1595 *1596 * @constant1597 * @type {Color}1598 */1599 Color.NAVY = Object.freeze(Color.fromCssColorString('#000080'));1600 /**1601 * An immutable Color instance initialized to CSS color #FDF5E61602 * <span class="colorSwath" style="background: #FDF5E6;"></span>1603 *1604 * @constant1605 * @type {Color}1606 */1607 Color.OLDLACE = Object.freeze(Color.fromCssColorString('#FDF5E6'));1608 /**1609 * An immutable Color instance initialized to CSS color #8080001610 * <span class="colorSwath" style="background: #808000;"></span>1611 *1612 * @constant1613 * @type {Color}1614 */1615 Color.OLIVE = Object.freeze(Color.fromCssColorString('#808000'));1616 /**1617 * An immutable Color instance initialized to CSS color #6B8E231618 * <span class="colorSwath" style="background: #6B8E23;"></span>1619 *1620 * @constant1621 * @type {Color}1622 */1623 Color.OLIVEDRAB = Object.freeze(Color.fromCssColorString('#6B8E23'));1624 /**1625 * An immutable Color instance initialized to CSS color #FFA5001626 * <span class="colorSwath" style="background: #FFA500;"></span>1627 *1628 * @constant1629 * @type {Color}1630 */1631 Color.ORANGE = Object.freeze(Color.fromCssColorString('#FFA500'));1632 /**1633 * An immutable Color instance initialized to CSS color #FF45001634 * <span class="colorSwath" style="background: #FF4500;"></span>1635 *1636 * @constant1637 * @type {Color}1638 */1639 Color.ORANGERED = Object.freeze(Color.fromCssColorString('#FF4500'));1640 /**1641 * An immutable Color instance initialized to CSS color #DA70D61642 * <span class="colorSwath" style="background: #DA70D6;"></span>1643 *1644 * @constant1645 * @type {Color}1646 */1647 Color.ORCHID = Object.freeze(Color.fromCssColorString('#DA70D6'));1648 /**1649 * An immutable Color instance initialized to CSS color #EEE8AA1650 * <span class="colorSwath" style="background: #EEE8AA;"></span>1651 *1652 * @constant1653 * @type {Color}1654 */1655 Color.PALEGOLDENROD = Object.freeze(Color.fromCssColorString('#EEE8AA'));1656 /**1657 * An immutable Color instance initialized to CSS color #98FB981658 * <span class="colorSwath" style="background: #98FB98;"></span>1659 *1660 * @constant1661 * @type {Color}1662 */1663 Color.PALEGREEN = Object.freeze(Color.fromCssColorString('#98FB98'));1664 /**1665 * An immutable Color instance initialized to CSS color #AFEEEE1666 * <span class="colorSwath" style="background: #AFEEEE;"></span>1667 *1668 * @constant1669 * @type {Color}1670 */1671 Color.PALETURQUOISE = Object.freeze(Color.fromCssColorString('#AFEEEE'));1672 /**1673 * An immutable Color instance initialized to CSS color #DB70931674 * <span class="colorSwath" style="background: #DB7093;"></span>1675 *1676 * @constant1677 * @type {Color}1678 */1679 Color.PALEVIOLETRED = Object.freeze(Color.fromCssColorString('#DB7093'));1680 /**1681 * An immutable Color instance initialized to CSS color #FFEFD51682 * <span class="colorSwath" style="background: #FFEFD5;"></span>1683 *1684 * @constant1685 * @type {Color}1686 */1687 Color.PAPAYAWHIP = Object.freeze(Color.fromCssColorString('#FFEFD5'));1688 /**1689 * An immutable Color instance initialized to CSS color #FFDAB91690 * <span class="colorSwath" style="background: #FFDAB9;"></span>1691 *1692 * @constant1693 * @type {Color}1694 */1695 Color.PEACHPUFF = Object.freeze(Color.fromCssColorString('#FFDAB9'));1696 /**1697 * An immutable Color instance initialized to CSS color #CD853F1698 * <span class="colorSwath" style="background: #CD853F;"></span>1699 *1700 * @constant1701 * @type {Color}1702 */1703 Color.PERU = Object.freeze(Color.fromCssColorString('#CD853F'));1704 /**1705 * An immutable Color instance initialized to CSS color #FFC0CB1706 * <span class="colorSwath" style="background: #FFC0CB;"></span>1707 *1708 * @constant1709 * @type {Color}1710 */1711 Color.PINK = Object.freeze(Color.fromCssColorString('#FFC0CB'));1712 /**1713 * An immutable Color instance initialized to CSS color #DDA0DD1714 * <span class="colorSwath" style="background: #DDA0DD;"></span>1715 *1716 * @constant1717 * @type {Color}1718 */1719 Color.PLUM = Object.freeze(Color.fromCssColorString('#DDA0DD'));1720 /**1721 * An immutable Color instance initialized to CSS color #B0E0E61722 * <span class="colorSwath" style="background: #B0E0E6;"></span>1723 *1724 * @constant1725 * @type {Color}1726 */1727 Color.POWDERBLUE = Object.freeze(Color.fromCssColorString('#B0E0E6'));1728 /**1729 * An immutable Color instance initialized to CSS color #8000801730 * <span class="colorSwath" style="background: #800080;"></span>1731 *1732 * @constant1733 * @type {Color}1734 */1735 Color.PURPLE = Object.freeze(Color.fromCssColorString('#800080'));1736 /**1737 * An immutable Color instance initialized to CSS color #FF00001738 * <span class="colorSwath" style="background: #FF0000;"></span>1739 *1740 * @constant1741 * @type {Color}1742 */1743 Color.RED = Object.freeze(Color.fromCssColorString('#FF0000'));1744 /**1745 * An immutable Color instance initialized to CSS color #BC8F8F1746 * <span class="colorSwath" style="background: #BC8F8F;"></span>1747 *1748 * @constant1749 * @type {Color}1750 */1751 Color.ROSYBROWN = Object.freeze(Color.fromCssColorString('#BC8F8F'));1752 /**1753 * An immutable Color instance initialized to CSS color #4169E11754 * <span class="colorSwath" style="background: #4169E1;"></span>1755 *1756 * @constant1757 * @type {Color}1758 */1759 Color.ROYALBLUE = Object.freeze(Color.fromCssColorString('#4169E1'));1760 /**1761 * An immutable Color instance initialized to CSS color #8B45131762 * <span class="colorSwath" style="background: #8B4513;"></span>1763 *1764 * @constant1765 * @type {Color}1766 */1767 Color.SADDLEBROWN = Object.freeze(Color.fromCssColorString('#8B4513'));1768 /**1769 * An immutable Color instance initialized to CSS color #FA80721770 * <span class="colorSwath" style="background: #FA8072;"></span>1771 *1772 * @constant1773 * @type {Color}1774 */1775 Color.SALMON = Object.freeze(Color.fromCssColorString('#FA8072'));1776 /**1777 * An immutable Color instance initialized to CSS color #F4A4601778 * <span class="colorSwath" style="background: #F4A460;"></span>1779 *1780 * @constant1781 * @type {Color}1782 */1783 Color.SANDYBROWN = Object.freeze(Color.fromCssColorString('#F4A460'));1784 /**1785 * An immutable Color instance initialized to CSS color #2E8B571786 * <span class="colorSwath" style="background: #2E8B57;"></span>1787 *1788 * @constant1789 * @type {Color}1790 */1791 Color.SEAGREEN = Object.freeze(Color.fromCssColorString('#2E8B57'));1792 /**1793 * An immutable Color instance initialized to CSS color #FFF5EE1794 * <span class="colorSwath" style="background: #FFF5EE;"></span>1795 *1796 * @constant1797 * @type {Color}1798 */1799 Color.SEASHELL = Object.freeze(Color.fromCssColorString('#FFF5EE'));1800 /**1801 * An immutable Color instance initialized to CSS color #A0522D1802 * <span class="colorSwath" style="background: #A0522D;"></span>1803 *1804 * @constant1805 * @type {Color}1806 */1807 Color.SIENNA = Object.freeze(Color.fromCssColorString('#A0522D'));1808 /**1809 * An immutable Color instance initialized to CSS color #C0C0C01810 * <span class="colorSwath" style="background: #C0C0C0;"></span>1811 *1812 * @constant1813 * @type {Color}1814 */1815 Color.SILVER = Object.freeze(Color.fromCssColorString('#C0C0C0'));1816 /**1817 * An immutable Color instance initialized to CSS color #87CEEB1818 * <span class="colorSwath" style="background: #87CEEB;"></span>1819 *1820 * @constant1821 * @type {Color}1822 */1823 Color.SKYBLUE = Object.freeze(Color.fromCssColorString('#87CEEB'));1824 /**1825 * An immutable Color instance initialized to CSS color #6A5ACD1826 * <span class="colorSwath" style="background: #6A5ACD;"></span>1827 *1828 * @constant1829 * @type {Color}1830 */1831 Color.SLATEBLUE = Object.freeze(Color.fromCssColorString('#6A5ACD'));1832 /**1833 * An immutable Color instance initialized to CSS color #7080901834 * <span class="colorSwath" style="background: #708090;"></span>1835 *1836 * @constant1837 * @type {Color}1838 */1839 Color.SLATEGRAY = Object.freeze(Color.fromCssColorString('#708090'));1840 /**1841 * An immutable Color instance initialized to CSS color #7080901842 * <span class="colorSwath" style="background: #708090;"></span>1843 *1844 * @constant1845 * @type {Color}1846 */1847 Color.SLATEGREY = Color.SLATEGRAY;1848 /**1849 * An immutable Color instance initialized to CSS color #FFFAFA1850 * <span class="colorSwath" style="background: #FFFAFA;"></span>1851 *1852 * @constant1853 * @type {Color}1854 */1855 Color.SNOW = Object.freeze(Color.fromCssColorString('#FFFAFA'));1856 /**1857 * An immutable Color instance initialized to CSS color #00FF7F1858 * <span class="colorSwath" style="background: #00FF7F;"></span>1859 *1860 * @constant1861 * @type {Color}1862 */1863 Color.SPRINGGREEN = Object.freeze(Color.fromCssColorString('#00FF7F'));1864 /**1865 * An immutable Color instance initialized to CSS color #4682B41866 * <span class="colorSwath" style="background: #4682B4;"></span>1867 *1868 * @constant1869 * @type {Color}1870 */1871 Color.STEELBLUE = Object.freeze(Color.fromCssColorString('#4682B4'));1872 /**1873 * An immutable Color instance initialized to CSS color #D2B48C1874 * <span class="colorSwath" style="background: #D2B48C;"></span>1875 *1876 * @constant1877 * @type {Color}1878 */1879 Color.TAN = Object.freeze(Color.fromCssColorString('#D2B48C'));1880 /**1881 * An immutable Color instance initialized to CSS color #0080801882 * <span class="colorSwath" style="background: #008080;"></span>1883 *1884 * @constant1885 * @type {Color}1886 */1887 Color.TEAL = Object.freeze(Color.fromCssColorString('#008080'));1888 /**1889 * An immutable Color instance initialized to CSS color #D8BFD81890 * <span class="colorSwath" style="background: #D8BFD8;"></span>1891 *1892 * @constant1893 * @type {Color}1894 */1895 Color.THISTLE = Object.freeze(Color.fromCssColorString('#D8BFD8'));1896 /**1897 * An immutable Color instance initialized to CSS color #FF63471898 * <span class="colorSwath" style="background: #FF6347;"></span>1899 *1900 * @constant1901 * @type {Color}1902 */1903 Color.TOMATO = Object.freeze(Color.fromCssColorString('#FF6347'));1904 /**1905 * An immutable Color instance initialized to CSS color #40E0D01906 * <span class="colorSwath" style="background: #40E0D0;"></span>1907 *1908 * @constant1909 * @type {Color}1910 */1911 Color.TURQUOISE = Object.freeze(Color.fromCssColorString('#40E0D0'));1912 /**1913 * An immutable Color instance initialized to CSS color #EE82EE1914 * <span class="colorSwath" style="background: #EE82EE;"></span>1915 *1916 * @constant1917 * @type {Color}1918 */1919 Color.VIOLET = Object.freeze(Color.fromCssColorString('#EE82EE'));1920 /**1921 * An immutable Color instance initialized to CSS color #F5DEB31922 * <span class="colorSwath" style="background: #F5DEB3;"></span>1923 *1924 * @constant1925 * @type {Color}1926 */1927 Color.WHEAT = Object.freeze(Color.fromCssColorString('#F5DEB3'));1928 /**1929 * An immutable Color instance initialized to CSS color #FFFFFF1930 * <span class="colorSwath" style="background: #FFFFFF;"></span>1931 *1932 * @constant1933 * @type {Color}1934 */1935 Color.WHITE = Object.freeze(Color.fromCssColorString('#FFFFFF'));1936 /**1937 * An immutable Color instance initialized to CSS color #F5F5F51938 * <span class="colorSwath" style="background: #F5F5F5;"></span>1939 *1940 * @constant1941 * @type {Color}1942 */1943 Color.WHITESMOKE = Object.freeze(Color.fromCssColorString('#F5F5F5'));1944 /**1945 * An immutable Color instance initialized to CSS color #FFFF001946 * <span class="colorSwath" style="background: #FFFF00;"></span>1947 *1948 * @constant1949 * @type {Color}1950 */1951 Color.YELLOW = Object.freeze(Color.fromCssColorString('#FFFF00'));1952 /**1953 * An immutable Color instance initialized to CSS color #9ACD321954 * <span class="colorSwath" style="background: #9ACD32;"></span>1955 *1956 * @constant1957 * @type {Color}1958 */1959 Color.YELLOWGREEN = Object.freeze(Color.fromCssColorString('#9ACD32'));1960 /**1961 * An immutable Color instance initialized to CSS transparent.1962 * <span class="colorSwath" style="background: transparent;"></span>1963 *1964 * @constant1965 * @type {Color}1966 */1967 Color.TRANSPARENT = Object.freeze(new Color(0, 0, 0, 0));...
index.js
Source:index.js
1var express = require('express');2var app = express();3var data = [4 { id: 1, color: "brown", disposition: "closed" },5 { id: 2, color: "yellow", disposition: "open" },6 { id: 3, color: "brown", disposition: "closed" },7 { id: 4, color: "brown", disposition: "open" },8 { id: 5, color: "red", disposition: "closed" },9 { id: 6, color: "blue", disposition: "open" },10 { id: 7, color: "green", disposition: "closed" },11 { id: 8, color: "green", disposition: "open" },12 { id: 9, color: "brown", disposition: "closed" },13 { id: 10, color: "red", disposition: "open" },14 { id: 11, color: "blue", disposition: "closed" },15 { id: 12, color: "yellow", disposition: "open" },16 { id: 13, color: "green", disposition: "open" },17 { id: 14, color: "yellow", disposition: "open" },18 { id: 15, color: "blue", disposition: "closed" },19 { id: 16, color: "blue", disposition: "closed" },20 { id: 17, color: "blue", disposition: "closed" },21 { id: 18, color: "green", disposition: "open" },22 { id: 19, color: "yellow", disposition: "open" },23 { id: 20, color: "brown", disposition: "closed" },24 { id: 21, color: "green", disposition: "closed" },25 { id: 22, color: "red", disposition: "closed" },26 { id: 23, color: "red", disposition: "open" },27 { id: 24, color: "red", disposition: "open" },28 { id: 25, color: "red", disposition: "open" },29 { id: 26, color: "red", disposition: "closed" },30 { id: 27, color: "brown", disposition: "closed" },31 { id: 28, color: "blue", disposition: "open" },32 { id: 29, color: "brown", disposition: "closed" },33 { id: 30, color: "blue", disposition: "closed" },34 { id: 31, color: "red", disposition: "open" },35 { id: 32, color: "blue", disposition: "open" },36 { id: 33, color: "yellow", disposition: "open" },37 { id: 34, color: "red", disposition: "open" },38 { id: 35, color: "blue", disposition: "open" },39 { id: 36, color: "green", disposition: "closed" },40 { id: 37, color: "green", disposition: "open" },41 { id: 38, color: "blue", disposition: "open" },42 { id: 39, color: "green", disposition: "closed" },43 { id: 40, color: "red", disposition: "closed" },44 { id: 41, color: "brown", disposition: "open" },45 { id: 42, color: "brown", disposition: "closed" },46 { id: 43, color: "green", disposition: "closed" },47 { id: 44, color: "blue", disposition: "closed" },48 { id: 45, color: "blue", disposition: "closed" },49 { id: 46, color: "yellow", disposition: "closed" },50 { id: 47, color: "green", disposition: "open" },51 { id: 48, color: "red", disposition: "closed" },52 { id: 49, color: "blue", disposition: "closed" },53 { id: 50, color: "blue", disposition: "open" },54 { id: 51, color: "green", disposition: "open" },55 { id: 52, color: "yellow", disposition: "open" },56 { id: 53, color: "yellow", disposition: "closed" },57 { id: 54, color: "red", disposition: "open" },58 { id: 55, color: "brown", disposition: "open" },59 { id: 56, color: "brown", disposition: "closed" },60 { id: 57, color: "blue", disposition: "open" },61 { id: 58, color: "brown", disposition: "closed" },62 { id: 59, color: "red", disposition: "open" },63 { id: 60, color: "brown", disposition: "closed" },64 { id: 61, color: "brown", disposition: "open" },65 { id: 62, color: "yellow", disposition: "closed" },66 { id: 63, color: "yellow", disposition: "open" },67 { id: 64, color: "yellow", disposition: "closed" },68 { id: 65, color: "green", disposition: "closed" },69 { id: 66, color: "blue", disposition: "open" },70 { id: 67, color: "green", disposition: "closed" },71 { id: 68, color: "brown", disposition: "open" },72 { id: 69, color: "blue", disposition: "closed" },73 { id: 70, color: "brown", disposition: "closed" },74 { id: 71, color: "green", disposition: "closed" },75 { id: 72, color: "green", disposition: "closed" },76 { id: 73, color: "blue", disposition: "closed" },77 { id: 74, color: "yellow", disposition: "closed" },78 { id: 75, color: "red", disposition: "closed" },79 { id: 76, color: "red", disposition: "open" },80 { id: 77, color: "blue", disposition: "closed" },81 { id: 78, color: "red", disposition: "closed" },82 { id: 79, color: "blue", disposition: "closed" },83 { id: 80, color: "blue", disposition: "open" },84 { id: 81, color: "brown", disposition: "closed" },85 { id: 82, color: "green", disposition: "closed" },86 { id: 83, color: "blue", disposition: "open" },87 { id: 84, color: "brown", disposition: "open" },88 { id: 85, color: "green", disposition: "open" },89 { id: 86, color: "yellow", disposition: "closed" },90 { id: 87, color: "yellow", disposition: "open" },91 { id: 88, color: "green", disposition: "open" },92 { id: 89, color: "yellow", disposition: "open" },93 { id: 90, color: "blue", disposition: "closed" },94 { id: 91, color: "brown", disposition: "closed" },95 { id: 92, color: "brown", disposition: "closed" },96 { id: 93, color: "brown", disposition: "closed" },97 { id: 94, color: "blue", disposition: "open" },98 { id: 95, color: "green", disposition: "open" },99 { id: 96, color: "green", disposition: "closed" },100 { id: 97, color: "red", disposition: "closed" },101 { id: 98, color: "yellow", disposition: "closed" },102 { id: 99, color: "brown", disposition: "open" },103 { id: 100, color: "red", disposition: "open" },104 { id: 101, color: "yellow", disposition: "closed" },105 { id: 102, color: "yellow", disposition: "closed" },106 { id: 103, color: "blue", disposition: "open" },107 { id: 104, color: "yellow", disposition: "closed" },108 { id: 105, color: "green", disposition: "open" },109 { id: 106, color: "yellow", disposition: "open" },110 { id: 107, color: "brown", disposition: "open" },111 { id: 108, color: "red", disposition: "open" },112 { id: 109, color: "green", disposition: "open" },113 { id: 110, color: "brown", disposition: "closed" },114 { id: 111, color: "brown", disposition: "open" },115 { id: 112, color: "yellow", disposition: "open" },116 { id: 113, color: "blue", disposition: "open" },117 { id: 114, color: "yellow", disposition: "open" },118 { id: 115, color: "green", disposition: "closed" },119 { id: 116, color: "red", disposition: "open" },120 { id: 117, color: "blue", disposition: "open" },121 { id: 118, color: "blue", disposition: "open" },122 { id: 119, color: "yellow", disposition: "closed" },123 { id: 120, color: "brown", disposition: "open" },124 { id: 121, color: "blue", disposition: "open" },125 { id: 122, color: "red", disposition: "open" },126 { id: 123, color: "brown", disposition: "open" },127 { id: 124, color: "red", disposition: "closed" },128 { id: 125, color: "blue", disposition: "open" },129 { id: 126, color: "yellow", disposition: "open" },130 { id: 127, color: "brown", disposition: "closed" },131 { id: 128, color: "red", disposition: "open" },132 { id: 129, color: "green", disposition: "closed" },133 { id: 130, color: "green", disposition: "open" },134 { id: 131, color: "red", disposition: "open" },135 { id: 132, color: "red", disposition: "closed" },136 { id: 133, color: "blue", disposition: "closed" },137 { id: 134, color: "yellow", disposition: "closed" },138 { id: 135, color: "brown", disposition: "closed" },139 { id: 136, color: "red", disposition: "open" },140 { id: 137, color: "blue", disposition: "closed" },141 { id: 138, color: "yellow", disposition: "closed" },142 { id: 139, color: "red", disposition: "open" },143 { id: 140, color: "yellow", disposition: "open" },144 { id: 141, color: "red", disposition: "open" },145 { id: 142, color: "red", disposition: "closed" },146 { id: 143, color: "red", disposition: "closed" },147 { id: 144, color: "green", disposition: "closed" },148 { id: 145, color: "yellow", disposition: "closed" },149 { id: 146, color: "green", disposition: "closed" },150 { id: 147, color: "brown", disposition: "closed" },151 { id: 148, color: "yellow", disposition: "open" },152 { id: 149, color: "red", disposition: "closed" },153 { id: 150, color: "green", disposition: "closed" },154 { id: 151, color: "brown", disposition: "open" },155 { id: 152, color: "yellow", disposition: "open" },156 { id: 153, color: "yellow", disposition: "closed" },157 { id: 154, color: "yellow", disposition: "closed" },158 { id: 155, color: "yellow", disposition: "closed" },159 { id: 156, color: "brown", disposition: "closed" },160 { id: 157, color: "green", disposition: "closed" },161 { id: 158, color: "green", disposition: "closed" },162 { id: 159, color: "brown", disposition: "open" },163 { id: 160, color: "green", disposition: "closed" },164 { id: 161, color: "red", disposition: "closed" },165 { id: 162, color: "blue", disposition: "open" },166 { id: 163, color: "green", disposition: "open" },167 { id: 164, color: "red", disposition: "open" },168 { id: 165, color: "red", disposition: "closed" },169 { id: 166, color: "yellow", disposition: "closed" },170 { id: 167, color: "blue", disposition: "open" },171 { id: 168, color: "green", disposition: "closed" },172 { id: 169, color: "green", disposition: "open" },173 { id: 170, color: "green", disposition: "open" },174 { id: 171, color: "blue", disposition: "open" },175 { id: 172, color: "blue", disposition: "closed" },176 { id: 173, color: "green", disposition: "closed" },177 { id: 174, color: "brown", disposition: "open" },178 { id: 175, color: "red", disposition: "closed" },179 { id: 176, color: "red", disposition: "closed" },180 { id: 177, color: "brown", disposition: "closed" },181 { id: 178, color: "brown", disposition: "open" },182 { id: 179, color: "red", disposition: "open" },183 { id: 180, color: "brown", disposition: "closed" },184 { id: 181, color: "green", disposition: "open" },185 { id: 182, color: "green", disposition: "closed" },186 { id: 183, color: "blue", disposition: "open" },187 { id: 184, color: "blue", disposition: "closed" },188 { id: 185, color: "blue", disposition: "closed" },189 { id: 186, color: "blue", disposition: "closed" },190 { id: 187, color: "brown", disposition: "closed" },191 { id: 188, color: "yellow", disposition: "open" },192 { id: 189, color: "red", disposition: "closed" },193 { id: 190, color: "brown", disposition: "open" },194 { id: 191, color: "green", disposition: "closed" },195 { id: 192, color: "red", disposition: "open" },196 { id: 193, color: "green", disposition: "closed" },197 { id: 194, color: "brown", disposition: "closed" },198 { id: 195, color: "brown", disposition: "closed" },199 { id: 196, color: "yellow", disposition: "closed" },200 { id: 197, color: "blue", disposition: "closed" },201 { id: 198, color: "green", disposition: "closed" },202 { id: 199, color: "yellow", disposition: "closed" },203 { id: 200, color: "green", disposition: "open" },204 { id: 201, color: "brown", disposition: "closed" },205 { id: 202, color: "blue", disposition: "closed" },206 { id: 203, color: "red", disposition: "open" },207 { id: 204, color: "green", disposition: "closed" },208 { id: 205, color: "brown", disposition: "closed" },209 { id: 206, color: "brown", disposition: "open" },210 { id: 207, color: "brown", disposition: "open" },211 { id: 208, color: "blue", disposition: "closed" },212 { id: 209, color: "brown", disposition: "closed" },213 { id: 210, color: "blue", disposition: "open" },214 { id: 211, color: "green", disposition: "closed" },215 { id: 212, color: "yellow", disposition: "open" },216 { id: 213, color: "blue", disposition: "open" },217 { id: 214, color: "red", disposition: "closed" },218 { id: 215, color: "red", disposition: "open" },219 { id: 216, color: "yellow", disposition: "open" },220 { id: 217, color: "yellow", disposition: "open" },221 { id: 218, color: "green", disposition: "open" },222 { id: 219, color: "green", disposition: "open" },223 { id: 220, color: "green", disposition: "open" },224 { id: 221, color: "yellow", disposition: "open" },225 { id: 222, color: "red", disposition: "closed" },226 { id: 223, color: "green", disposition: "closed" },227 { id: 224, color: "blue", disposition: "closed" },228 { id: 225, color: "yellow", disposition: "closed" },229 { id: 226, color: "yellow", disposition: "open" },230 { id: 227, color: "red", disposition: "open" },231 { id: 228, color: "blue", disposition: "open" },232 { id: 229, color: "yellow", disposition: "open" },233 { id: 230, color: "blue", disposition: "closed" },234 { id: 231, color: "green", disposition: "open" },235 { id: 232, color: "blue", disposition: "open" },236 { id: 233, color: "yellow", disposition: "closed" },237 { id: 234, color: "yellow", disposition: "closed" },238 { id: 235, color: "brown", disposition: "open" },239 { id: 236, color: "red", disposition: "closed" },240 { id: 237, color: "blue", disposition: "closed" },241 { id: 238, color: "red", disposition: "closed" },242 { id: 239, color: "yellow", disposition: "open" },243 { id: 240, color: "blue", disposition: "open" },244 { id: 241, color: "red", disposition: "open" },245 { id: 242, color: "yellow", disposition: "closed" },246 { id: 243, color: "blue", disposition: "open" },247 { id: 244, color: "yellow", disposition: "open" },248 { id: 245, color: "yellow", disposition: "open" },249 { id: 246, color: "red", disposition: "closed" },250 { id: 247, color: "yellow", disposition: "open" },251 { id: 248, color: "green", disposition: "open" },252 { id: 249, color: "yellow", disposition: "closed" },253 { id: 250, color: "green", disposition: "open" },254 { id: 251, color: "blue", disposition: "open" },255 { id: 252, color: "blue", disposition: "open" },256 { id: 253, color: "green", disposition: "open" },257 { id: 254, color: "green", disposition: "open" },258 { id: 255, color: "yellow", disposition: "open" },259 { id: 256, color: "red", disposition: "open" },260 { id: 257, color: "blue", disposition: "open" },261 { id: 258, color: "blue", disposition: "open" },262 { id: 259, color: "red", disposition: "open" },263 { id: 260, color: "brown", disposition: "open" },264 { id: 261, color: "yellow", disposition: "open" },265 { id: 262, color: "green", disposition: "closed" },266 { id: 263, color: "green", disposition: "open" },267 { id: 264, color: "blue", disposition: "closed" },268 { id: 265, color: "green", disposition: "closed" },269 { id: 266, color: "yellow", disposition: "open" },270 { id: 267, color: "yellow", disposition: "closed" },271 { id: 268, color: "green", disposition: "closed" },272 { id: 269, color: "red", disposition: "closed" },273 { id: 270, color: "blue", disposition: "closed" },274 { id: 271, color: "red", disposition: "open" },275 { id: 272, color: "yellow", disposition: "open" },276 { id: 273, color: "brown", disposition: "closed" },277 { id: 274, color: "red", disposition: "open" },278 { id: 275, color: "red", disposition: "open" },279 { id: 276, color: "yellow", disposition: "open" },280 { id: 277, color: "red", disposition: "open" },281 { id: 278, color: "blue", disposition: "closed" },282 { id: 279, color: "brown", disposition: "closed" },283 { id: 280, color: "brown", disposition: "open" },284 { id: 281, color: "brown", disposition: "closed" },285 { id: 282, color: "red", disposition: "open" },286 { id: 283, color: "blue", disposition: "closed" },287 { id: 284, color: "red", disposition: "closed" },288 { id: 285, color: "blue", disposition: "closed" },289 { id: 286, color: "red", disposition: "open" },290 { id: 287, color: "blue", disposition: "open" },291 { id: 288, color: "yellow", disposition: "open" },292 { id: 289, color: "red", disposition: "closed" },293 { id: 290, color: "red", disposition: "open" },294 { id: 291, color: "brown", disposition: "open" },295 { id: 292, color: "red", disposition: "closed" },296 { id: 293, color: "brown", disposition: "open" },297 { id: 294, color: "brown", disposition: "open" },298 { id: 295, color: "green", disposition: "closed" },299 { id: 296, color: "red", disposition: "closed" },300 { id: 297, color: "brown", disposition: "closed" },301 { id: 298, color: "green", disposition: "closed" },302 { id: 299, color: "brown", disposition: "closed" },303 { id: 300, color: "blue", disposition: "open" },304 { id: 301, color: "green", disposition: "closed" },305 { id: 302, color: "red", disposition: "closed" },306 { id: 303, color: "red", disposition: "open" },307 { id: 304, color: "yellow", disposition: "open" },308 { id: 305, color: "brown", disposition: "open" },309 { id: 306, color: "green", disposition: "open" },310 { id: 307, color: "brown", disposition: "closed" },311 { id: 308, color: "blue", disposition: "open" },312 { id: 309, color: "yellow", disposition: "open" },313 { id: 310, color: "yellow", disposition: "open" },314 { id: 311, color: "red", disposition: "closed" },315 { id: 312, color: "yellow", disposition: "open" },316 { id: 313, color: "red", disposition: "closed" },317 { id: 314, color: "blue", disposition: "open" },318 { id: 315, color: "green", disposition: "open" },319 { id: 316, color: "blue", disposition: "open" },320 { id: 317, color: "red", disposition: "closed" },321 { id: 318, color: "blue", disposition: "open" },322 { id: 319, color: "green", disposition: "closed" },323 { id: 320, color: "red", disposition: "closed" },324 { id: 321, color: "brown", disposition: "open" },325 { id: 322, color: "green", disposition: "open" },326 { id: 323, color: "yellow", disposition: "open" },327 { id: 324, color: "red", disposition: "closed" },328 { id: 325, color: "green", disposition: "closed" },329 { id: 326, color: "green", disposition: "closed" },330 { id: 327, color: "yellow", disposition: "open" },331 { id: 328, color: "yellow", disposition: "closed" },332 { id: 329, color: "brown", disposition: "open" },333 { id: 330, color: "brown", disposition: "closed" },334 { id: 331, color: "blue", disposition: "closed" },335 { id: 332, color: "brown", disposition: "open" },336 { id: 333, color: "blue", disposition: "closed" },337 { id: 334, color: "green", disposition: "open" },338 { id: 335, color: "brown", disposition: "closed" },339 { id: 336, color: "blue", disposition: "open" },340 { id: 337, color: "green", disposition: "open" },341 { id: 338, color: "green", disposition: "closed" },342 { id: 339, color: "green", disposition: "open" },343 { id: 340, color: "red", disposition: "open" },344 { id: 341, color: "yellow", disposition: "open" },345 { id: 342, color: "brown", disposition: "closed" },346 { id: 343, color: "red", disposition: "open" },347 { id: 344, color: "brown", disposition: "open" },348 { id: 345, color: "blue", disposition: "open" },349 { id: 346, color: "green", disposition: "open" },350 { id: 347, color: "yellow", disposition: "open" },351 { id: 348, color: "blue", disposition: "open" },352 { id: 349, color: "brown", disposition: "closed" },353 { id: 350, color: "green", disposition: "closed" },354 { id: 351, color: "blue", disposition: "closed" },355 { id: 352, color: "brown", disposition: "closed" },356 { id: 353, color: "blue", disposition: "closed" },357 { id: 354, color: "brown", disposition: "open" },358 { id: 355, color: "blue", disposition: "open" },359 { id: 356, color: "red", disposition: "open" },360 { id: 357, color: "green", disposition: "open" },361 { id: 358, color: "blue", disposition: "closed" },362 { id: 359, color: "brown", disposition: "open" },363 { id: 360, color: "red", disposition: "closed" },364 { id: 361, color: "brown", disposition: "open" },365 { id: 362, color: "green", disposition: "open" },366 { id: 363, color: "yellow", disposition: "open" },367 { id: 364, color: "blue", disposition: "open" },368 { id: 365, color: "green", disposition: "closed" },369 { id: 366, color: "blue", disposition: "closed" },370 { id: 367, color: "blue", disposition: "open" },371 { id: 368, color: "red", disposition: "open" },372 { id: 369, color: "green", disposition: "closed" },373 { id: 370, color: "red", disposition: "closed" },374 { id: 371, color: "brown", disposition: "closed" },375 { id: 372, color: "red", disposition: "open" },376 { id: 373, color: "yellow", disposition: "open" },377 { id: 374, color: "blue", disposition: "open" },378 { id: 375, color: "green", disposition: "open" },379 { id: 376, color: "yellow", disposition: "open" },380 { id: 377, color: "blue", disposition: "open" },381 { id: 378, color: "blue", disposition: "closed" },382 { id: 379, color: "green", disposition: "closed" },383 { id: 380, color: "green", disposition: "open" },384 { id: 381, color: "blue", disposition: "open" },385 { id: 382, color: "green", disposition: "open" },386 { id: 383, color: "blue", disposition: "closed" },387 { id: 384, color: "blue", disposition: "closed" },388 { id: 385, color: "brown", disposition: "closed" },389 { id: 386, color: "red", disposition: "closed" },390 { id: 387, color: "red", disposition: "closed" },391 { id: 388, color: "green", disposition: "open" },392 { id: 389, color: "brown", disposition: "open" },393 { id: 390, color: "green", disposition: "open" },394 { id: 391, color: "red", disposition: "closed" },395 { id: 392, color: "blue", disposition: "open" },396 { id: 393, color: "yellow", disposition: "closed" },397 { id: 394, color: "green", disposition: "open" },398 { id: 395, color: "yellow", disposition: "closed" },399 { id: 396, color: "red", disposition: "closed" },400 { id: 397, color: "red", disposition: "open" },401 { id: 398, color: "green", disposition: "open" },402 { id: 399, color: "brown", disposition: "open" },403 { id: 400, color: "yellow", disposition: "closed" },404 { id: 401, color: "brown", disposition: "closed" },405 { id: 402, color: "yellow", disposition: "closed" },406 { id: 403, color: "red", disposition: "closed" },407 { id: 404, color: "blue", disposition: "open" },408 { id: 405, color: "brown", disposition: "open" },409 { id: 406, color: "blue", disposition: "open" },410 { id: 407, color: "blue", disposition: "closed" },411 { id: 408, color: "yellow", disposition: "open" },412 { id: 409, color: "green", disposition: "closed" },413 { id: 410, color: "red", disposition: "open" },414 { id: 411, color: "green", disposition: "open" },415 { id: 412, color: "green", disposition: "open" },416 { id: 413, color: "blue", disposition: "closed" },417 { id: 414, color: "blue", disposition: "open" },418 { id: 415, color: "yellow", disposition: "open" },419 { id: 416, color: "brown", disposition: "closed" },420 { id: 417, color: "red", disposition: "closed" },421 { id: 418, color: "green", disposition: "open" },422 { id: 419, color: "green", disposition: "open" },423 { id: 420, color: "yellow", disposition: "closed" },424 { id: 421, color: "green", disposition: "open" },425 { id: 422, color: "red", disposition: "open" },426 { id: 423, color: "yellow", disposition: "open" },427 { id: 424, color: "green", disposition: "closed" },428 { id: 425, color: "green", disposition: "open" },429 { id: 426, color: "blue", disposition: "closed" },430 { id: 427, color: "red", disposition: "closed" },431 { id: 428, color: "brown", disposition: "closed" },432 { id: 429, color: "green", disposition: "closed" },433 { id: 430, color: "red", disposition: "open" },434 { id: 431, color: "blue", disposition: "open" },435 { id: 432, color: "green", disposition: "open" },436 { id: 433, color: "yellow", disposition: "open" },437 { id: 434, color: "brown", disposition: "closed" },438 { id: 435, color: "yellow", disposition: "closed" },439 { id: 436, color: "red", disposition: "open" },440 { id: 437, color: "yellow", disposition: "closed" },441 { id: 438, color: "yellow", disposition: "closed" },442 { id: 439, color: "green", disposition: "closed" },443 { id: 440, color: "brown", disposition: "closed" },444 { id: 441, color: "blue", disposition: "open" },445 { id: 442, color: "red", disposition: "closed" },446 { id: 443, color: "brown", disposition: "closed" },447 { id: 444, color: "blue", disposition: "closed" },448 { id: 445, color: "red", disposition: "open" },449 { id: 446, color: "green", disposition: "closed" },450 { id: 447, color: "brown", disposition: "open" },451 { id: 448, color: "brown", disposition: "open" },452 { id: 449, color: "blue", disposition: "closed" },453 { id: 450, color: "blue", disposition: "closed" },454 { id: 451, color: "green", disposition: "open" },455 { id: 452, color: "yellow", disposition: "open" },456 { id: 453, color: "yellow", disposition: "closed" },457 { id: 454, color: "green", disposition: "closed" },458 { id: 455, color: "blue", disposition: "open" },459 { id: 456, color: "red", disposition: "closed" },460 { id: 457, color: "green", disposition: "open" },461 { id: 458, color: "blue", disposition: "closed" },462 { id: 459, color: "green", disposition: "open" },463 { id: 460, color: "green", disposition: "open" },464 { id: 461, color: "yellow", disposition: "open" },465 { id: 462, color: "green", disposition: "open" },466 { id: 463, color: "green", disposition: "open" },467 { id: 464, color: "red", disposition: "open" },468 { id: 465, color: "red", disposition: "open" },469 { id: 466, color: "blue", disposition: "closed" },470 { id: 467, color: "yellow", disposition: "open" },471 { id: 468, color: "blue", disposition: "closed" },472 { id: 469, color: "brown", disposition: "closed" },473 { id: 470, color: "green", disposition: "open" },474 { id: 471, color: "yellow", disposition: "closed" },475 { id: 472, color: "red", disposition: "open" },476 { id: 473, color: "red", disposition: "closed" },477 { id: 474, color: "yellow", disposition: "open" },478 { id: 475, color: "brown", disposition: "open" },479 { id: 476, color: "brown", disposition: "closed" },480 { id: 477, color: "red", disposition: "open" },481 { id: 478, color: "brown", disposition: "closed" },482 { id: 479, color: "brown", disposition: "open" },483 { id: 480, color: "blue", disposition: "open" },484 { id: 481, color: "blue", disposition: "open" },485 { id: 482, color: "red", disposition: "open" },486 { id: 483, color: "yellow", disposition: "closed" },487 { id: 484, color: "blue", disposition: "closed" },488 { id: 485, color: "blue", disposition: "closed" },489 { id: 486, color: "yellow", disposition: "open" },490 { id: 487, color: "green", disposition: "closed" },491 { id: 488, color: "brown", disposition: "open" },492 { id: 489, color: "brown", disposition: "closed" },493 { id: 490, color: "brown", disposition: "closed" },494 { id: 491, color: "red", disposition: "open" },495 { id: 492, color: "green", disposition: "closed" },496 { id: 493, color: "green", disposition: "closed" },497 { id: 494, color: "green", disposition: "closed" },498 { id: 495, color: "red", disposition: "closed" },499 { id: 496, color: "red", disposition: "closed" },500 { id: 497, color: "yellow", disposition: "closed" },501 { id: 498, color: "yellow", disposition: "closed" },502 { id: 499, color: "red", disposition: "closed" },503 { id: 500, color: "blue", disposition: "closed" }504];505app.use(function(req, res, next) {506 res.header('Access-Control-Allow-Origin', "*");507 res.header('Access-Control-Allow-Methods','GET');508 res.header('Access-Control-Allow-Headers', 'Content-Type');509 next();510});511app.get('/records', function (req, res) {512 var limit = parseInt(req.query.limit) || 100;513 var offset = parseInt(req.query.offset) || 0;514 var colorFilters = req.query.color;515 var response;516 if (typeof req.query.color !== "undefined" && !Array.isArray(req.query.color)) {517 res.status(400).send('Bad Request');518 return;519 }520 if (isNaN(limit) || limit < 0 || isNaN(offset) || offset < 0) {521 res.status(400).send('Bad Request');522 return;523 }524 if (colorFilters && colorFilters.length) {525 response = data526 .filter(function(item){ return colorFilters.indexOf(item.color) !== -1; })527 .slice(offset, offset + limit);528 } else {529 response = data.slice(offset, offset + limit);530 }531 res.send(response);532});533app.listen(3000, function () {534 console.log('Records API listening on port 3000!')...
jquery.colorpicker.js
Source:jquery.colorpicker.js
1/*2 mColorPicker3 Version: 1.0 r344 5 Copyright (c) 2010 Meta100 LLC.6 http://www.meta100.com/7 8 Licensed under the MIT license 9 http://www.opensource.org/licenses/mit-license.php 10*/11// After this script loads set:12// $.fn.mColorPicker.init.replace = '.myclass'13// to have this script apply to input.myclass,14// instead of the default input[type=color]15// To turn of automatic operation and run manually set:16// $.fn.mColorPicker.init.replace = false17// To use manually call like any other jQuery plugin18// $('input.foo').mColorPicker({options})19// options:20// imageFolder - Change to move image location.21// swatches - Initial colors in the swatch, must an array of 10 colors.22// init:23// $.fn.mColorPicker.init.enhancedSwatches - Turn of saving and loading of swatch to cookies.24// $.fn.mColorPicker.init.allowTransparency - Turn off transperancy as a color option.25// $.fn.mColorPicker.init.showLogo - Turn on/off the meta100 logo (You don't really want to turn it off, do you?).26(function($){27 var $o;28 $.fn.mColorPicker = function(options) {29 30 $o = $.extend($.fn.mColorPicker.defaults, options); 31 if ($o.swatches.length < 10) $o.swatches = $.fn.mColorPicker.defaults.swatches32 if ($("div#mColorPicker").length < 1) $.fn.mColorPicker.drawPicker();33 if ($('#css_disabled_color_picker').length < 1) $('head').prepend('<style id="css_disabled_color_picker" type="text/css">.mColorPicker[disabled] + span, .mColorPicker[disabled="disabled"] + span, .mColorPicker[disabled="true"] + span {filter:alpha(opacity=50);-moz-opacity:0.5;-webkit-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}</style>');34 $('.mColorPicker').live('keyup', function () {35 36 try {37 38 $(this).css({39 'background-color': $(this).val()40 }).css({41 'color': $.fn.mColorPicker.textColor($(this).css('background-color'))42 }).trigger('change');43 } catch (r) {}44 });45 $('.mColorPickerTrigger').live('click', function () {46 $.fn.mColorPicker.colorShow($(this).attr('id').replace('icp_', ''));47 });48 this.each(function () {49 $.fn.mColorPicker.drawPickerTriggers($(this));50 });51 return this;52 };53 $.fn.mColorPicker.currentColor = false;54 $.fn.mColorPicker.currentValue = false;55 $.fn.mColorPicker.color = false;56 $.fn.mColorPicker.init = {57 replace: '[type=color]',58 index: 0,59 enhancedSwatches: true,60 allowTransparency: false,61 checkRedraw: 'DOMUpdated', // Change to 'ajaxSuccess' for ajax only or false if not needed62 liveEvents: false,63 showLogo: false64 };65 $.fn.mColorPicker.defaults = {66 imageFolder: '../img/admin/',67 swatches: [68 "#ffffff",69 "#ffff00",70 "#00ff00",71 "#00ffff",72 "#0000ff",73 "#ff00ff",74 "#ff0000",75 "#4c2b11",76 "#3b3b3b",77 "#000000"78 ]79 };80 $.fn.mColorPicker.liveEvents = function() {81 $.fn.mColorPicker.init.liveEvents = true;82 if ($.fn.mColorPicker.init.checkRedraw && $.fn.mColorPicker.init.replace) {83 $(document).bind($.fn.mColorPicker.init.checkRedraw + '.mColorPicker', function () {84 $('input[data-mcolorpicker!="true"]').filter(function() {85 86 return ($.fn.mColorPicker.init.replace == '[type=color]')? this.getAttribute("type") == 'color': $(this).is($.fn.mColorPicker.init.replace);87 }).mColorPicker();88 });89 }90 };91 $.fn.mColorPicker.drawPickerTriggers = function ($t) {92 if ($t[0].nodeName.toLowerCase() != 'input') return false;93 var id = $t.attr('id') || 'color_' + $.fn.mColorPicker.init.index++,94 hidden = false;95 $t.attr('id', id);96 97 if ($t.attr('text') == 'hidden' || $t.attr('data-text') == 'hidden') hidden = true;98 var color = $t.val(),99 width = ($t.width() > 0)? $t.width(): parseInt($t.css('width'), 10),100 height = ($t.height())? $t.height(): parseInt($t.css('height'), 10),101 flt = $t.css('float'),102 image = (color == 'transparent')? "url('" + $o.imageFolder + "/grid.gif')": '',103 colorPicker = '';104 $('body').append('<span id="color_work_area"></span>');105 $('span#color_work_area').append($t.clone(true));106 colorPicker = $('span#color_work_area').html().replace(/type="color"/gi, '').replace(/input /gi, (hidden)? 'input type="hidden"': 'input type="text"');107 $('span#color_work_area').html('').remove();108 $t.after(109 (hidden)? '<span style="cursor:pointer;border:1px solid black;float:' + flt + ';width:' + width + 'px;height:' + height + 'px;" id="icp_' + id + '"> </span>': ''110 ).after(colorPicker).remove(); 111 if (hidden) {112 $('#icp_' + id).css({113 'background-color': color,114 'background-image': image,115 'display': 'inline-block'116 }).attr(117 'class', $('#' + id).attr('class')118 ).addClass(119 'mColorPickerTrigger'120 );121 } else {122 $('#' + id).css({123 'background-color': color,124 'background-image': image125 }).css({126 'color': $.fn.mColorPicker.textColor($('#' + id).css('background-color'))127 }).after(128 '<span style="cursor:pointer;" id="icp_' + id + '" class="mColorPickerTrigger input-group-addon"><img src="' + $o.imageFolder + 'color.png" style="border:0;margin:0 0 0 3px" align="absmiddle"></span>'129 ).addClass('mColorPickerInput');130 }131 $('#icp_' + id).attr('data-mcolorpicker', 'true');132 $('#' + id).addClass('mColorPicker');133 return $('#' + id);134 };135 $.fn.mColorPicker.drawPicker = function () {136 $(document.createElement("div")).attr(137 "id","mColorPicker"138 ).css(139 'display','none'140 ).html(141 '<div id="mColorPickerWrapper"><div id="mColorPickerImg" class="mColor"></div><div id="mColorPickerImgGray" class="mColor"></div><div id="mColorPickerSwatches"><div class="mClear"></div></div><div id="mColorPickerFooter"><input type="text" size="8" id="mColorPickerInput"/></div></div>'142 ).appendTo("body");143 $(document.createElement("div")).attr("id","mColorPickerBg").css({144 'display': 'none'145 }).appendTo("body");146 for (n = 9; n > -1; n--) {147 $(document.createElement("div")).attr({148 'id': 'cell' + n,149 'class': "mPastColor" + ((n > 0)? ' mNoLeftBorder': '')150 }).html(151 ' '152 ).prependTo("#mColorPickerSwatches");153 }154 $('#mColorPicker').css({155 'border':'1px solid #ccc',156 'color':'#fff',157 'z-index':999998,158 'width':'194px',159 'height':'184px',160 'font-size':'12px',161 'font-family':'times'162 });163 $('.mPastColor').css({164 'height':'18px',165 'width':'18px',166 'border':'1px solid #000',167 'float':'left'168 });169 $('#colorPreview').css({170 'height':'50px'171 });172 $('.mNoLeftBorder').css({173 'border-left':0174 });175 $('.mClear').css({176 'clear':'both'177 });178 $('#mColorPickerWrapper').css({179 'position':'relative',180 'border':'solid 1px gray',181 'z-index':999999182 });183 184 $('#mColorPickerImg').css({185 'height':'128px',186 'width':'192px',187 'border':0,188 'cursor':'crosshair',189 'background-image':"url('" + $o.imageFolder + "colorpicker.png')"190 });191 192 $('#mColorPickerImgGray').css({193 'height':'8px',194 'width':'192px',195 'border':0,196 'cursor':'crosshair',197 'background-image':"url('" + $o.imageFolder + "graybar.jpg')"198 });199 200 $('#mColorPickerInput').css({201 'border':'solid 1px gray',202 'font-size':'10pt',203 'margin':'3px',204 'width':'80px'205 });206 207 $('#mColorPickerImgGrid').css({208 'border':0,209 'height':'20px',210 'width':'20px',211 'vertical-align':'text-bottom'212 });213 214 $('#mColorPickerSwatches').css({215 'border-right':'1px solid #000'216 });217 218 $('#mColorPickerFooter').css({219 'background-image':"url('" + $o.imageFolder + "grid.gif')",220 'position': 'relative',221 'height':'26px'222 });223 if ($.fn.mColorPicker.init.allowTransparency) $('#mColorPickerFooter').prepend('<span id="mColorPickerTransparent" class="mColor" style="font-size:16px;color:#000;padding-right:30px;padding-top:3px;cursor:pointer;overflow:hidden;float:right;">transparent</span>');224 if ($.fn.mColorPicker.init.showLogo) $('#mColorPickerFooter').prepend('<a href="http://meta100.com/" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="float:right;" target="_blank"><img src="' + $o.imageFolder + 'meta100.png" title="Meta100 - Designing Fun" alt="Meta100 - Designing Fun" style="border:0;border-left:1px solid #aaa;right:0;position:absolute;"/></a>');225 $("#mColorPickerBg").click($.fn.mColorPicker.closePicker);226 var swatch = $.fn.mColorPicker.getCookie('swatches'),227 i = 0;228 if (typeof swatch == 'string') swatch = swatch.split('||');229 if (swatch == null || $.fn.mColorPicker.init.enhancedSwatches || swatch.length < 10) swatch = $o.swatches;230 $(".mPastColor").each(function() {231 $(this).css('background-color', swatch[i++].toLowerCase());232 });233 };234 $.fn.mColorPicker.closePicker = function () {235 $(".mColor, .mPastColor, #mColorPickerInput, #mColorPickerWrapper").unbind();236 $("#mColorPickerBg").hide();237 $("#mColorPicker").fadeOut()238 };239 $.fn.mColorPicker.colorShow = function (id) {240 var $e = $("#icp_" + id);241 pos = $e.offset(),242 $i = $("#" + id);243 hex = $i.attr('data-hex') || $i.attr('hex'),244 pickerTop = pos.top + $e.outerHeight(),245 pickerLeft = pos.left,246 $d = $(document),247 $m = $("#mColorPicker");248 if ($i.attr('disabled')) return false;249 // KEEP COLOR PICKER IN VIEWPORT250 if (pickerTop + $m.height() > $d.height()) pickerTop = pos.top - $m.height();251 if (pickerLeft + $m.width() > $d.width()) pickerLeft = pos.left - $m.width() + $e.outerWidth();252 253 $m.css({254 'top':(pickerTop) + "px",255 'left':(pickerLeft) + "px",256 'position':'absolute'257 }).fadeIn("fast");258 259 $("#mColorPickerBg").css({260 'z-index':999990,261 'background':'black',262 'opacity': .01,263 'position':'absolute',264 'top':0,265 'left':0,266 'width': parseInt($d.width(), 10) + 'px',267 'height': parseInt($d.height(), 10) + 'px'268 }).show();269 270 var def = $i.val();271 272 $('#colorPreview span').text(def);273 $('#colorPreview').css('background', def);274 $('#color').val(def);275 276 if ($('#' + id).attr('data-text')) $.fn.mColorPicker.currentColor = $e.css('background-color');277 else $.fn.mColorPicker.currentColor = $i.css('background-color');278 if (hex == 'true') $.fn.mColorPicker.currentColor = $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.currentColor);279 $("#mColorPickerInput").val($.fn.mColorPicker.currentColor);280 281 $('.mColor, .mPastColor').bind('mousemove', function(e) {282 283 var offset = $(this).offset();284 $.fn.mColorPicker.color = $(this).css("background-color");285 if ($(this).hasClass('mPastColor') && hex == 'true') $.fn.mColorPicker.color = $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color);286 else if ($(this).hasClass('mPastColor') && hex != 'true') $.fn.mColorPicker.color = $.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color);287 else if ($(this).attr('id') == 'mColorPickerTransparent') $.fn.mColorPicker.color = 'transparent';288 else if (!$(this).hasClass('mPastColor')) $.fn.mColorPicker.color = $.fn.mColorPicker.whichColor(e.pageX - offset.left, e.pageY - offset.top + (($(this).attr('id') == 'mColorPickerImgGray')? 128: 0), hex);289 $.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.color);290 }).click(function() {291 292 $.fn.mColorPicker.colorPicked(id);293 });294 295 $('#mColorPickerInput').bind('keyup', function (e) {296 297 try {298 299 $.fn.mColorPicker.color = $('#mColorPickerInput').val();300 $.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.color);301 302 if (e.which == 13) $.fn.mColorPicker.colorPicked(id);303 } catch (r) {}304 }).bind('blur', function () {305 306 $.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.currentColor);307 });308 309 $('#mColorPickerWrapper').bind('mouseleave', function () {310 311 $.fn.mColorPicker.setInputColor(id, $.fn.mColorPicker.currentColor);312 });313 };314 $.fn.mColorPicker.setInputColor = function (id, color) {315 316 var image = (color == 'transparent')? "url('" + $o.imageFolder + "grid.gif')": '',317 textColor = $.fn.mColorPicker.textColor(color);318 319 if ($('#' + id).attr('data-text') || $('#' + id).attr('text')) $("#icp_" + id).css({'background-color': color, 'background-image': image});320 $("#" + id).val(color).css({'background-color': color, 'background-image': image, 'color' : textColor}).trigger('change');321 $("#mColorPickerInput").val(color);322 };323 $.fn.mColorPicker.textColor = function (val) {324 325 if (typeof val == 'undefined' || val == 'transparent') return "black";326 val = $.fn.mColorPicker.RGBtoHex(val);327 return (parseInt(val.substr(1, 2), 16) + parseInt(val.substr(3, 2), 16) + parseInt(val.substr(5, 2), 16) < 400)? 'white': 'black';328 };329 $.fn.mColorPicker.setCookie = function (name, value, days) {330 331 var cookie_string = name + "=" + escape(value),332 expires = new Date();333 expires.setDate(expires.getDate() + days);334 cookie_string += "; expires=" + expires.toGMTString();335 336 document.cookie = cookie_string;337 };338 $.fn.mColorPicker.getCookie = function (name) {339 340 var results = document.cookie.match ( '(^|;) ?' + name + '=([^;]*)(;|$)' );341 342 if (results) return (unescape(results[2]));343 else return null;344 };345 $.fn.mColorPicker.colorPicked = function (id) {346 347 $.fn.mColorPicker.closePicker();348 349 if ($.fn.mColorPicker.init.enhancedSwatches) $.fn.mColorPicker.addToSwatch();350 351 $("#" + id).trigger('colorpicked');352 };353 $.fn.mColorPicker.addToSwatch = function (color) {354 355 var swatch = []356 i = 0;357 358 if (typeof color == 'string') $.fn.mColorPicker.color = color.toLowerCase();359 360 $.fn.mColorPicker.currentValue = $.fn.mColorPicker.currentColor = $.fn.mColorPicker.color;361 362 if ($.fn.mColorPicker.color != 'transparent') swatch[0] = $.fn.mColorPicker.color.toLowerCase();363 364 $('.mPastColor').each(function() {365 366 $.fn.mColorPicker.color = $(this).css('background-color').toLowerCase();367 if ($.fn.mColorPicker.color != swatch[0] && $.fn.mColorPicker.RGBtoHex($.fn.mColorPicker.color) != swatch[0] && $.fn.mColorPicker.hexToRGB($.fn.mColorPicker.color) != swatch[0] && swatch.length < 10) swatch[swatch.length] = $.fn.mColorPicker.color;368 369 $(this).css('background-color', swatch[i++])370 });371 if ($.fn.mColorPicker.init.enhancedSwatches) $.fn.mColorPicker.setCookie('swatches', swatch.join('||'), 365);372 };373 $.fn.mColorPicker.whichColor = function (x, y, hex) {374 375 var colorR = colorG = colorB = 255;376 377 if (x < 32) {378 379 colorG = x * 8;380 colorB = 0;381 } else if (x < 64) {382 383 colorR = 256 - (x - 32 ) * 8;384 colorB = 0;385 } else if (x < 96) {386 387 colorR = 0;388 colorB = (x - 64) * 8;389 } else if (x < 128) {390 391 colorR = 0;392 colorG = 256 - (x - 96) * 8;393 } else if (x < 160) {394 395 colorR = (x - 128) * 8;396 colorG = 0;397 } else {398 399 colorG = 0;400 colorB = 256 - (x - 160) * 8;401 }402 403 if (y < 64) {404 405 colorR += (256 - colorR) * (64 - y) / 64;406 colorG += (256 - colorG) * (64 - y) / 64;407 colorB += (256 - colorB) * (64 - y) / 64;408 } else if (y <= 128) {409 410 colorR -= colorR * (y - 64) / 64;411 colorG -= colorG * (y - 64) / 64;412 colorB -= colorB * (y - 64) / 64;413 } else if (y > 128) {414 415 colorR = colorG = colorB = 256 - ( x / 192 * 256 );416 }417 colorR = Math.round(Math.min(colorR, 255));418 colorG = Math.round(Math.min(colorG, 255));419 colorB = Math.round(Math.min(colorB, 255));420 if (hex == 'true') {421 colorR = colorR.toString(16);422 colorG = colorG.toString(16);423 colorB = colorB.toString(16);424 425 if (colorR.length < 2) colorR = 0 + colorR;426 if (colorG.length < 2) colorG = 0 + colorG;427 if (colorB.length < 2) colorB = 0 + colorB;428 return "#" + colorR + colorG + colorB;429 }430 431 return "rgb(" + colorR + ', ' + colorG + ', ' + colorB + ')';432 };433 $.fn.mColorPicker.RGBtoHex = function (color) {434 color = color.toLowerCase();435 if (typeof color == 'undefined') return '';436 if (color.indexOf('#') > -1 && color.length > 6) return color;437 if (color.indexOf('rgb') < 0) return color;438 if (color.indexOf('#') > -1) {439 return '#' + color.substr(1, 1) + color.substr(1, 1) + color.substr(2, 1) + color.substr(2, 1) + color.substr(3, 1) + color.substr(3, 1);440 }441 var hexArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],442 decToHex = "#",443 code1 = 0;444 445 color = color.replace(/[^0-9,]/g, '').split(",");446 for (var n = 0; n < color.length; n++) {447 code1 = Math.floor(color[n] / 16);448 decToHex += hexArray[code1] + hexArray[color[n] - code1 * 16];449 }450 451 return decToHex;452 };453 $.fn.mColorPicker.hexToRGB = function (color) {454 color = color.toLowerCase();455 456 if (typeof color == 'undefined') return '';457 if (color.indexOf('rgb') > -1) return color;458 if (color.indexOf('#') < 0) return color;459 var c = color.replace('#', '');460 if (c.length < 6) c = c.substr(0, 1) + c.substr(0, 1) + c.substr(1, 1) + c.substr(1, 1) + c.substr(2, 1) + c.substr(2, 1);461 return 'rgb(' + parseInt(c.substr(0, 2), 16) + ', ' + parseInt(c.substr(2, 2), 16) + ', ' + parseInt(c.substr(4, 2), 16) + ')';462 };463 $(document).ready(function () {464 if ($.fn.mColorPicker.init.replace) {465 466 $('input[data-mcolorpicker!="true"]').filter(function() {467 468 return ($.fn.mColorPicker.init.replace == '[type=color]')? this.getAttribute("type") == 'color': $(this).is($.fn.mColorPicker.init.replace);469 }).mColorPicker();470 $.fn.mColorPicker.liveEvents();471 }472 });...
mColorPicker.js
Source:mColorPicker.js
1/*2 mColorPicker3 Version: 1.0.04 5 Copyright (c) 2010 Meta100 LLC.6 7 Permission is hereby granted, free of charge, to any person8 obtaining a copy of this software and associated documentation9 files (the "Software"), to deal in the Software without10 restriction, including without limitation the rights to use,11 copy, modify, merge, publish, distribute, sublicense, and/or sell12 copies of the Software, and to permit persons to whom the13 Software is furnished to do so, subject to the following14 conditions:15 16 The above copyright notice and this permission notice shall be17 included in all copies or substantial portions of the Software.18 19 Except as contained in this notice, the name(s) of the above 20 copyright holders shall not be used in advertising or otherwise 21 to promote the sale, use or other dealings in this Software 22 without prior written authorization.23 24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,25 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES26 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND27 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT28 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,29 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING30 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR31 OTHER DEALINGS IN THE SOFTWARE.32*/33mColorPicker = {34 current_color: false,35 current_value: false,36 color: false,37 imageUrl: cfg_site_url+'js/lib/jQuery_plugins/mColorPicker/images/', //Change if you want to use local images.38 swatches: ["#ffffff","#ffff00","#00ff00","#00ffff","#0000ff","#ff00ff","#ff0000","#4c2b11","#3b3b3b","#000000"],39 colorShow: function (id, updateInput) {40 var id2 = 'icp_' + id;41 eICP = jQuery("#" + id2).offset();42 43 jQuery("#mColorPicker").css({44 'top':(eICP.top + jQuery("#" + id2).outerHeight()) + "px",45 'left':(eICP.left) + "px",46 'position':'absolute'47 }).fadeIn("fast");48 49 jQuery("#mColorPickerBg").css({50 'position':'absolute',51 'top':0,52 'left':0,53 'width':'100%',54 'height':'100%'55 }).fadeIn("fast");56 57 var def = jQuery("#" + id).val();58 59 jQuery('#colorPreview span').text(def);60 jQuery('#colorPreview').css('background', def);61 jQuery('#color').val(def);62 63 mColorPicker.current_color = jQuery('#' + id).val();64 mColorPicker.color = jQuery('#' + id).css('background-color');65 var hxs = jQuery('#mColorPicker');66 67 jQuery('#mColorPickerImg').unbind().mousemove(function(e) {68 69 var offset = jQuery('#mColorPickerImg').offset();70 71 mColorPicker.color = mColorPicker.whichColor (e.pageX - offset.left, e.pageY - offset.top);72 mColorPicker.setInputColor(id, mColorPicker.color, updateInput);73 }).bind('mouseleave', function (e) {74 75 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);76 }).click(function(e) {77 78 mColorPicker.colorPicked(id, updateInput);79 });80 81 jQuery('#mColorPickerImgGray').unbind().mousemove(function(e) {82 83 var offset = jQuery('#mColorPickerImgGray').offset();84 85 mColorPicker.color = mColorPicker.whichColor (e.pageX - offset.left, e.pageY - offset.top + 128);86 mColorPicker.setInputColor(id, mColorPicker.color, updateInput);87 }).bind('mouseleave', function (e) {88 89 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);90 }).click(function(e) {91 92 mColorPicker.colorPicked(id, updateInput);93 });94 95 jQuery('.pastColor').unbind().mousemove(function(e) {96 97 mColorPicker.color = mColorPicker.toRGBHex(jQuery(this).css("background-color"));98 mColorPicker.setInputColor(id, mColorPicker.color, updateInput);99 }).bind('mouseleave', function (e) {100 101 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);102 }).click(function(e) {103 104 mColorPicker.colorPicked(id, updateInput);105 });106 107 jQuery('#mColorPickerTransparent').unbind().mouseover(function(e) {108 109 mColorPicker.color = 'transparent';110 mColorPicker.setInputColor(id, mColorPicker.color, updateInput);111 }).bind('mouseleave', function (e) {112 113 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);114 }).click(function(e) {115 116 mColorPicker.colorPicked(id, updateInput);117 });118 119 jQuery('#mColorPickerInput').unbind().bind('keyup', function (e) {120 121 mColorPicker.color = jQuery('#mColorPickerInput').val();122 mColorPicker.setInputColor(id, mColorPicker.color, updateInput);123 124 if (e.which == 13) {125 mColorPicker.colorPicked(id, updateInput);126 }127 }).bind('blur', function (e) {128 129 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);130 });131 132 jQuery('#mColorPickerSwatches').unbind().bind('mouseleave', function (e) {133 134 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);135 });136 137 jQuery('#mColorPickerFooter').unbind().bind('mouseleave', function (e) {138 139 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);140 });141 142 jQuery('#mColorPickerWrapper').unbind().bind('mouseleave', function (e) {143 144 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);145 });146 147 jQuery('#mColorPicker').unbind().bind('mouseleave', function (e) {148 149 mColorPicker.setInputColor(id, mColorPicker.current_color, updateInput);150 });151 },152 setInputColor: function (id, color, updateInput) {153 154 var image = (color == 'transparent')? "url('" + mColorPicker.imageUrl + "grid.gif')": '',155 textColor = (color == 'transparent')? "#000000": mColorPicker.textColor(color);156 157 if (updateInput) jQuery("#icp_" + id).css({'background-color': color, 'background-image': image});158 jQuery("#" + id).val(color).css({'background-color': color, 'background-image': image, 'color' : textColor});159 jQuery("#mColorPickerInput").val(color);160 },161 textColor: function (val) {162 163 return (parseInt(val.substr(1, 2), 16) + parseInt(val.substr(3, 2), 16) + parseInt(val.substr(5, 2), 16) < 400)? 'white': 'black';164 },165 set_cookie: function (name, value, days) {166 167 var cookie_string = name + "=" + escape(value),168 expires = new Date();169 expires.setDate(expires.getDate() + days);170 cookie_string += "; expires=" + expires.toGMTString();171 172 document.cookie = cookie_string;173 },174 get_cookie: function (cookie_name) {175 176 var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );177 178 if (results) return (unescape(results[2]));179 else return null;180 },181 colorPicked: function (id, updateInput) {182 183 var swatch = [],184 i = 0;185 186 mColorPicker.current_value = mColorPicker.current_color = mColorPicker.color;187 188 jQuery("#mColorPickerImg").unbind();189 jQuery("#mColorPickerImgGray").unbind();190 jQuery(".pastColor").unbind();191 jQuery("#mColorPickerBg").hide();192 jQuery("#mColorPicker").fadeOut();193 194 if (mColorPicker.color != 'transparent') swatch[0] = mColorPicker.color;195 196 jQuery('.pastColor').each(function() {197 198 var color = mColorPicker.toRGBHex(jQuery(this).css('background-color'));199 if (color != swatch[0] && swatch.length < 10) {200 201 swatch[swatch.length] = color;202 }203 204 jQuery(this).css('background-color', swatch[i++])205 });206 207 mColorPicker.set_cookie('swatches', swatch.join(','), 365);208 },209 whichColor: function(x,y){210 211 var colorR = colorG = colorB = 256;212 213 if (x < 32) {214 215 colorG = x * 8;216 colorB = 1;217 } else if (x < 64) {218 219 colorR = 256 - (x - 32 ) * 8;220 colorB = 1;221 } else if (x < 96) {222 223 colorR = 1;224 colorB = (x - 64) * 8;225 } else if (x < 128) {226 227 colorR = 1;228 colorG = 256 - (x - 96) * 8;229 } else if (x < 160) {230 231 colorR = (x - 128) * 8;232 colorG = 1;233 } else {234 235 colorG = 1;236 colorB = 256 - (x - 160) * 8;237 }238 239 if (y < 64) {240 241 colorR = colorR + (256 - colorR) * (64 - y) / 64;242 colorG = colorG + (256 - colorG) * (64 - y) / 64;243 colorB = colorB + (256 - colorB) * (64 - y) / 64;244 } else if (y <= 128) {245 246 colorR = colorR - colorR * (y - 64) / 64;247 colorG = colorG - colorG * (y - 64) / 64;248 colorB = colorB - colorB * (y - 64) / 64;249 } else if (y > 128) {250 251 colorR = 256 - ( x / 192 * 256 );252 colorG = 256 - ( x / 192 * 256 );253 colorB = 256 - ( x / 192 * 256 );254 }255 256 colorR = parseInt(colorR);257 colorG = parseInt(colorG);258 colorB = parseInt(colorB);259 260 if (colorR >= 256) colorR = 255;261 if (colorG >= 256) colorG = 255;262 if (colorB >= 256) colorB = 255;263 264 colorR = colorR.toString(16);265 colorG = colorG.toString(16);266 colorB = colorB.toString(16);267 268 if (colorR.length < 2) colorR = 0 + colorR;269 if (colorG.length < 2) colorG = 0 + colorG;270 if (colorB.length < 2) colorB = 0 + colorB;271 272 return "#" + colorR + colorG + colorB;273 },274 toRGBHex: function (num) {275 276 if (num.indexOf('#') > -1) return num;277 var hexArray = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],278 decToHex = "#",279 code1 = 0;280 281 num = num.replace(/[^0-9,]/g, '').split(",");282 for (var n = 0; n < num.length; n++) {283 code1 = Math.floor(num[n] / 16);284 decToHex += hexArray[code1] + hexArray[num[n] - code1 * 16];285 }286 287 return decToHex;288 },289 main: function() {290 291 jQuery('input').filter(function(index) {292 293 return this.getAttribute("type") == 'color';294 }).each(function (i) {295 296 if (i == 0) {297 298 jQuery(document.createElement("div")).attr(299 "id","mColorPicker"300 ).css(301 'display','none'302 ).html(303 '<div id="mColorPickerWrapper"><div id="mColorPickerImg"></div><div id="mColorPickerImgGray"></div><div id="mColorPickerSwatches"><div id="cell0" class="pastColor"> </div><div id="cell1" class="pastColor noLeftBorder"> </div><div id="cell2" class="pastColor noLeftBorder"> </div><div id="cell3" class="pastColor noLeftBorder"> </div><div id="cell4" class="pastColor noLeftBorder"> </div><div id="cell5" class="pastColor noLeftBorder"> </div><div id="cell6" class="pastColor noLeftBorder"> </div><div id="cell7" class="pastColor noLeftBorder"> </div><div id="cell8" class="pastColor noLeftBorder"> </div><div id="cell9" class="pastColor noLeftBorder"> </div><div class="clear"></div></div><div id="mColorPickerFooter"><input type="text" size="8" id="mColorPickerInput"/><span id="mColorPickerTransparent">transparent</span></div></div>'304 ).appendTo("body");305 306 jQuery(document.createElement("div")).attr("id","mColorPickerBg").click(function() {307 308 jQuery("#mColorPickerBg").hide();309 jQuery("#mColorPicker").fadeOut()310 }).appendTo("body");311 312 jQuery('table.pickerTable td').css({313 'width':'12px',314 'height':'14px',315 'border':'1px solid #000',316 'cursor':'pointer'317 });318 319 jQuery('#mColorPicker table.pickerTable').css({320 'border-collapse':'collapse'321 });322 323 jQuery('#mColorPicker').css({324 'border':'1px solid #ccc',325 'background':'#333',326 'color':'#fff',327 'z-index':999998,328 'width':'194px',329 'height':'184px',330 'font-size':'12px',331 'font-family':'times'332 });333 334 jQuery('.pastColor').css({335 'height':'18px',336 'width':'18px',337 'border':'1px solid #000',338 'float':'left'339 });340 341 jQuery('#colorPreview').css({342 'height':'50px'343 });344 345 jQuery('.noLeftBorder').css({346 'border-left':'0'347 });348 349 jQuery('.clear').css({350 'clear':'both'351 });352 353 jQuery('#mColorPickerWrapper').css({354 'position':'relative',355 'border':'solid 1px gray',356 'background-color':'white',357 'z-index':'999999'358 });359 360 jQuery('#mColorPickerImg').css({361 'height':'128px',362 'width':'192px',363 'border':'0',364 'cursor':'crosshair',365 'background-image':"url('" + mColorPicker.imageUrl + "colorpicker.png')"366 });367 368 jQuery('#mColorPickerImgGray').css({369 'height':'8px',370 'width':'192px',371 'border':'0',372 'cursor':'crosshair',373 'background-image':"url('" + mColorPicker.imageUrl + "graybar.jpg')"374 });375 376 jQuery('#mColorPickerInput').css({377 'border':'solid 1px gray',378 'font-size':'12pt',379 'margin':'1px'380 });381 382 jQuery('#mColorPickerImgGrid').css({383 'border':'0',384 'height':'20px',385 'width':'20px',386 'vertical-align':'text-bottom'387 });388 389 jQuery('#mColorPickerSwatches').css({390 'background-color':'#000'391 });392 393 jQuery('#mColorPickerFooter').css({394 'background-image':"url('" + mColorPicker.imageUrl + "grid.gif')"395 });396 397 jQuery('#mColorPickerTransparent').css({398 'font-size':' 18px',399 'color':'#000',400 'padding-left':' 4px',401 'cursor':' pointer',402 'overflow': 'hidden'403 });404 }405 406 var id = jQuery(this).attr('id'),407 currentTime = new Date(),408 updateInput = false;409 410 if (id == '') id = jQuery(this).attr('name');411 if (id == '') id = 'color_' + currentTime.getTime();412 413 jQuery(this).attr('id', id);414 415 if (jQuery(this).attr('text') == 'hidden') {416 417 var color = jQuery(this).val(),418 width = (jQuery(this).width() > 0)? jQuery(this).width(): parseInt(jQuery(this).css('width'));419 height = (jQuery(this).height())? jQuery(this).height(): parseInt(jQuery(this).css('height'));420 flt = jQuery(this).css('float'),421 image = (color == 'transparent')? "url('" + mColorPicker.imageUrl + "/grid.gif')": '',422 textColor = (color == 'transparent')? "#000000": mColorPicker.textColor(color),423 colorPicker = '';424 425 jQuery('body').append('<span id="color_work_area"></span>');426 jQuery('span#color_work_area').append(jQuery(this).clone(true));427 colorPicker = jQuery('span#color_work_area').html().replace(/type=[^a-z]*color[^a-z]*/gi, 'type="hidden"');428 jQuery('span#color_work_area').html('').remove();429 jQuery(this).after(430 '<span style="cursor:pointer;border:1px solid black;float:' + flt + ';width:' + width + 'px;height:' + height + 'px;" id="icp_' + id + '"> </span>'431 ).after(colorPicker).remove(); 432 433 jQuery('#icp_' + id).css({434 'background-color': color,435 'background-image': image,436 'display': 'inline-block',437 'color' : textColor438 });439 440 updateInput = true;441 } else {442 443 var color = jQuery(this).val(),444 id = jQuery(this).attr('id'),445 image = (color == 'transparent')? "url('" + mColorPicker.imageUrl + "/grid.gif')": '',446 textColor = (color == 'transparent')? "#000000": mColorPicker.textColor(color),447 colorPicker = '';448 449 jQuery('body').append('<span id="color_work_area"></span>');450 jQuery('span#color_work_area').append(jQuery(this).clone(true));451 colorPicker = jQuery('span#color_work_area').html().replace(/type=[^a-z]*color[^a-z]*/gi, 'type="text"');452 jQuery('span#color_work_area').html('').remove();453 jQuery(this).after(colorPicker).remove(); 454 jQuery('#' + id).css({455 'background-color': color,456 'background-image': image,457 'color' : textColor458 }).after(459 '<span style="cursor:pointer;" id="icp_' + id + '"><img src="' + mColorPicker.imageUrl + 'color.png" style="border:0;margin:0 0 0 3px" align="absmiddle"></span>'460 );461 }462 463 jQuery('#icp_' + id).bind('click', function () {464 465 mColorPicker.colorShow(id, updateInput);466 });467 468 var swatch = mColorPicker.get_cookie('swatches'),469 i = 0;470 471 if (swatch == null) swatch = mColorPicker.swatches;472 else swatch = swatch.split(',');473 474 jQuery(".pastColor").each(function() {475 476 jQuery(this).css('background-color', swatch[i++]);477 });478 });479 }480};481jQuery(document).ready(function () {482 mColorPicker.main();...
ThemeData.js
Source:ThemeData.js
1/*******************************************************************************2 * @license3 * Copyright (c) 2012, 2014 IBM Corporation and others.4 * All rights reserved. This program and the accompanying materials are made 5 * available under the terms of the Eclipse Public License v1.0 6 * (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution 7 * License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). 8 * 9 * Contributors: Anton McConville - IBM Corporation - initial API and implementation10 ******************************************************************************/11/*eslint-env browser, amd*/1213define([14 'orion/editor/textTheme',15 'orion/widgets/themes/ThemeVersion',16 'orion/objects',1718], function(mTextTheme, THEMES_VERSION, objects) {1920 // *******************************************************************************21 //22 // If you change any styles in this file, you must increment the version number23 // in ThemeVersion.js.24 //25 // *******************************************************************************2627 /* Synchronizing colors and styles for HTML, CSS and JS files like this ...28 29 Using Prospecto as an example:30 31 -----------------------------------------------32 CSS HTML JS33 -----------------------------------------------34 ORANGE Class Tag Keyword35 darkSlateGray Text Text Text36 darkSeaGreen Comments Comments Comments37 cornFlowerblue String String String38 ----------------------------------------------- */39 40 var defaultFont = '"Source Code Pro", "Consolas", "Monaco", "Vera Mono", monospace'; //$NON-NLS-0$41 var defaultFontSize = '12px'; //$NON-NLS-0$42 var prospecto, darker, ceol;4344 function ThemeData() {4546 this.styles = [];47 48 prospecto = {49 "className": "prospecto",50 "name": "Prospecto",51 "styles": {52 "annotationLine": {53 "currentLine": {54 "backgroundColor": "#EAF2FE"55 }56 },57 "annotationRange": {58 "currentBracket": {59 "backgroundColor": "#00FE00"60 },61 "matchingBracket": {62 "backgroundColor": "#00FE00"63 },64 "matchingSearch": {65 "backgroundColor": "#c3e1ff",66 "currentSearch": {67 "backgroundColor": "#53d1ff"68 }69 },70 "writeOccurrence": {71 "backgroundColor": "#ffff00"72 }73 },74 "backgroundColor": "#ffffff",75 "color": "#151515",76 "comment": {77 "color": "#3C802C"78 },79 "constant": {80 "color": "#9932CC",81 "numeric": {82 "color": "#9932CC",83 "hex": {84 "color": "#9932CC"85 }86 }87 },88 "entity": {89 "name": {90 "color": "#98937B",91 "function": {92 "color": "#67BBB8",93 "fontWeight": "bold"94 }95 },96 "other": {97 "attribute-name": {98 "color": "#5F9EA0"99 }100 }101 },102 "fontFamily": defaultFont,103 "fontSize": defaultFontSize,104 "keyword": {105 "control": {106 "color": "#CC4C07",107 "fontWeight": "bold"108 },109 "operator": {110 "color": "#9F4177",111 "fontWeight": "bold"112 },113 "other": {114 "documentation": {115 "color": "#7F9FBF",116 "task": {117 "color": "#5595ff"118 }119 }120 }121 },122 "markup": {123 "bold": {124 "fontWeight": "bold"125 },126 "heading": {127 "color": "#0000FF"128 },129 "italic": {130 "fontStyle": "italic"131 },132 "list": {133 "color": "#CC4C07"134 },135 "other": {136 "separator": {137 "color": "#00008F"138 },139 "strikethrough": {140 "textDecoration": "line-through"141 },142 "table": {143 "color": "#3C802C"144 }145 },146 "quote": {147 "color": "#446FBD"148 },149 "raw": {150 "fontFamily": "monospace",151 "html": {152 "backgroundColor": "#E4F7EF"153 }154 },155 "underline": {156 "link": {157 "textDecoration": "underline"158 }159 }160 },161 "meta": {162 "documentation": {163 "annotation": {164 "color": "#7F9FBF"165 },166 "tag": {167 "color": "#7F7F9F"168 }169 },170 "preprocessor": {171 "color": "#A4A4A4"172 },173 "tag": {174 "color": "#CC4C07",175 "attribute": {176 "color": "#93a2aa"177 }178 }179 },180 "punctuation": {181 "operator": {182 "color":"#D1416F"183 }184 },185 "ruler": {186 "annotations": {187 "backgroundColor": "#ffffff"188 },189 "backgroundColor": "#ffffff",190 "overview": {191 "backgroundColor": "#ffffff"192 }193 },194 "rulerLines": {195 "color": "#767676"196 },197 "string": {198 "color": "#446FBD",199 "interpolated": {200 "color": "#151515"201 }202 },203 "support": {204 "type": {205 "propertyName": {206 "color": "#9F4177"207 }208 }209 },210 "textviewContent ::-moz-selection": {211 "backgroundColor": "rgba(180,213,255,0.99)"212 },213 "textviewContent ::selection": {214 "backgroundColor": "rgba(180,213,255,0.99)"215 },216 "textviewLeftRuler": {217 "borderColor": "#ffffff"218 },219 "textviewRightRuler": {220 "borderColor": "#ffffff"221 },222 "textviewSelection": {223 "backgroundColor": "rgba(180,213,255,0.99)"224 },225 "textviewSelectionUnfocused": {226 "backgroundColor": "rgba(180,213,255,0.99)"227 },228 "variable": {229 "language": {230 "color": "#7F0055",231 "fontWeight": "bold"232 },233 "other": {234 "color": "#E038AD"235 },236 "parameter": {237 "color": "#D1416F"238 }239 }240 }241 };242 this.styles.push(prospecto);243244245 ceol = {246 "className": "ceol",247 "name": "Ceol",248 "styles": {249 "annotationLine": {250 "currentLine": {251 "backgroundColor": "#152935"252 }253 },254 "annotationRange": {255 "currentBracket": {256 "backgroundColor": "#00FE00"257 },258 "matchingBracket": {259 "backgroundColor": "#4178be"260 },261 "matchingSearch": {262 "backgroundColor": "#A6266E",263 "currentSearch": {264 "backgroundColor": "#008571"265 }266 },267 "writeOccurrence": {268 "backgroundColor": "#ffff00"269 }270 },271 "backgroundColor": "#152935",272 "color": "#ffa5b4",273 "comment": {274 "color": "#406d89"275 },276 "constant": {277 "color": "#7cc7ff",278 "numeric": {279 "color": "#71c9ff",280 "hex": {281 "color": "#71c9ff"282 }283 }284 },285 "entity": {286 "name": {287 "color": "#98937B",288 "function": {289 "color": "#67BBB8",290 "fontWeight": "bold"291 }292 },293 "other": {294 "attribute-name": {295 "color": "#5F9EA0"296 }297 }298 },299 "fontFamily": "\"Source Code Pro\", \"Consolas\", \"Monaco\", \"Vera Mono\", monospace",300 "fontSize": "12px",301 "keyword": {302 "control": {303 "color": "#a7fae6",304 "fontWeight": "bold"305 },306 "operator": {307 "color": "#a7fae6",308 "fontWeight": "bold"309 },310 "other": {311 "documentation": {312 "color": "#7F9FBF",313 "task": {314 "color": "#5595ff"315 }316 }317 }318 },319 "markup": {320 "bold": {321 "fontWeight": "bold"322 },323 "heading": {324 "color": "#0000FF"325 },326 "italic": {327 "fontStyle": "italic"328 },329 "list": {330 "color": "#CC4C07"331 },332 "other": {333 "separator": {334 "color": "#00008F"335 },336 "strikethrough": {337 "textDecoration": "line-through"338 },339 "table": {340 "color": "#3C802C"341 }342 },343 "quote": {344 "color": "#446FBD"345 },346 "raw": {347 "fontFamily": "monospace",348 "html": {349 "backgroundColor": "#E4F7EF"350 }351 },352 "underline": {353 "link": {354 "textDecoration": "underline"355 }356 }357 },358 "meta": {359 "documentation": {360 "annotation": {361 "color": "#7F9FBF"362 },363 "tag": {364 "color": "#7F7F9F"365 }366 },367 "preprocessor": {368 "color": "#A4A4A4"369 },370 "tag": {371 "attribute": {372 "color": "#eed2ff"373 },374 "color": "#a7fae7"375 }376 },377 "punctuation": {378 "operator": {379 "color": "#ba8ff7"380 }381 },382 "ruler": {383 "annotations": {384 "backgroundColor": "#112935"385 },386 "backgroundColor": "#112935",387 "overview": {388 "backgroundColor": "#112935"389 }390 },391 "rulerLines": {392 "color": "#396f8a",393 "even": {394 "color": "#396f8a"395 },396 "odd": {397 "color": "#396f8a"398 }399 },400 "string": {401 "color": "#61cdff",402 "interpolated": {403 "color": "#151515"404 }405 },406 "support": {407 "type": {408 "propertyName": {409 "color": "#a7fae7"410 }411 }412 },413 "textviewContent ::-moz-selection": {414 "backgroundColor": "rgba(50,92,128,0.99)"415 },416 "textviewContent ::selection": {417 "backgroundColor": "rgba(50,92,128,0.99)"418 },419 "textviewLeftRuler": {420 "borderColor": "#112935"421 },422 "textviewRightRuler": {423 "borderColor": "#112935"424 },425 "textviewSelection": {426 "backgroundColor": "rgba(50,92,128,0.99)"427 },428 "textviewSelectionUnfocused": {429 "backgroundColor": "rgba(50,92,128,0.99)"430 },431 "variable": {432 "language": {433 "color": "#a2f9e7",434 "fontWeight": "bold"435 },436 "other": {437 "color": "#E038AD"438 },439 "parameter": {440 "color": "#a2f9e7"441 }442 }443 }444 };445 this.styles.push(ceol);446447 darker = {448 "className": "darker",449 "name": "Darker",450 "styles": {451 "annotationLine": {452 "currentLine": {453 "backgroundColor": "#171c20"454 }455 },456 "annotationRange": {457 "currentBracket": {458 "backgroundColor": "#006E00"459 },460 "currentSearch": {461 "backgroundColor": "#5d5d5d"462 },463 "matchingBracket": {464 "backgroundColor": "#006E00"465 },466 "matchingSearch": {467 "backgroundColor": "#363636",468 "currentSearch": {469 "backgroundColor": "#465e47"470 }471 },472 "writeOccurrence": {473 "backgroundColor": "#093f59"474 }475 },476 "backgroundColor": "#1a1d1e",477 "color": "#dadada",478 "comment": {479 "block": {480 "color": "#5e7175"481 },482 "color": "#5e7175",483 "line": {484 "color": "#5e7175"485 }486 },487 "constant": {488 "color": "#c8333a",489 "numeric": {490 "color": "#c8333a",491 "hex": {492 "color": "#cd3f45"493 }494 }495 },496 "entity": {497 "name": {498 "color": "#30a7d3",499 "function": {500 "color": "#30a7d3",501 "fontWeight": "normal"502 }503 },504 "other": {505 "attribute-name": {506 "color":"#5F9EA0"507 }508 }509 },510 "fontFamily": defaultFont,511 "fontSize": defaultFontSize,512 "keyword": {513 "control": {514 "color": "#e8d075",515 "fontWeight":"normal"516 },517 "operator": {518 "color": "#91c23d",519 "fontWeight": "normal"520 },521 "other": {522 "documentation": {523 "color": "#7F9FBF",524 "task": {525 "color": "#8db6f1"526 }527 }528 }529 },530 "markup": {531 "bold": {532 "fontWeight": "bold"533 },534 "heading": {535 "color": "#91c23d"536 },537 "italic": {538 "fontStyle": "italic"539 },540 "list": {541 "color": "#CC4C07"542 },543 "other": {544 "separator": {545 "color":"#e8d075"546 },547 "strikethrough": {548 "textDecoration": "line-through"549 },550 "table": {551 "color": "#3C802C"552 }553 },554 "quote": {555 "color": "#55b5db"556 },557 "raw": {558 "fontFamily": "monospace",559 "html": {560 "backgroundColor": "#3B4B53"561 }562 },563 "underline": {564 "link": {565 "textDecoration": "underline"566 }567 }568 },569 "meta": {570 "documentation": {571 "annotation": {572 "color": "#7F9FBF"573 },574 "tag": {575 "color": "#7F7F9F"576 }577 },578 "preprocessor": {579 "color": "#A4A4A4"580 },581 "tag": {582 "color": "#999999",583 "attribute": {584 "color": "#07e2d9"585 }586 }587 },588 "punctuation": {589 "operator": {590 "color":"#FF8C00"591 }592 },593 "ruler": {594 "annotations": {595 "backgroundColor": "#0f1113"596 },597 "backgroundColor":"#0f1113",598 "overview": {599 "backgroundColor": "#0f1113"600 }601 },602 "rulerLines": {603 "color":"#3d4750",604 "even": {605 "color":"#3d4750"606 },607 "odd": {608 "color":"#3d4750"609 }610 },611 "string": {612 "color": "#55b5db",613 "interpolated": {614 "color":"#dadada"615 },616 "quoted": {617 "double": {618 "color": "#55b5db"619 },620 "single": {621 "color": "#55b5db"622 }623 }624 },625 "support": {626 "type": {627 "propertyName": {628 "color": "#9fca56"629 }630 }631 },632 "textviewContent ::-moz-selection": {633 "backgroundColor":"rgba(49,115,112,0.99)"634 },635 "textviewContent ::selection": {636 "backgroundColor":"rgba(49,115,112,0.99)"637 },638 "textviewLeftRuler": {639 "borderColor":"#0e1112"640 },641 "textviewRightRuler": {642 "borderColor":"#0e1112"643 },644 "textviewSelection": {645 "backgroundColor": "rgba(49,115,112,0.99)"646 },647 "textviewSelectionUnfocused": {648 "backgroundColor": "rgba(49,115,112,0.99)"649 },650 "variable": {651 "language": {652 "color": "#9fca56",653 "fontWeight":"normal"654 },655 "other": {656 "color":"#E038AD"657 },658 "parameter": {659 "color":"#FF8C00"660 }661 }662 }663 };664 this.styles.push(darker);665 }666 667 function getStyles(){668 return this.styles;669 }670 671 ThemeData.prototype.styles = [];672 ThemeData.prototype.getStyles = getStyles;673674 function getDefaultTheme(options) {675 /* return a copy of the appropriate theme definition */676 return JSON.parse(JSON.stringify((options || {}).dark ? darker : prospecto));677 }678 ThemeData.prototype.getDefaultTheme = getDefaultTheme;679 680 function getProtectedThemes() {681 return ["Prospecto", "Darker"]; //$NON-NLS-1$ //$NON-NLS-0$682 }683684 ThemeData.prototype.getProtectedThemes = getProtectedThemes;685686 var fontSettable = true;687 688 ThemeData.prototype.fontSettable = fontSettable;689 690 function getThemeStorageInfo(){691 return {692 storage:'/themes',693 styleset:'editorstyles',694 defaultTheme:'Prospecto',695 selectedKey: 'editorSelected',696 version: THEMES_VERSION697 }; 698 }699 ThemeData.prototype.getThemeStorageInfo = getThemeStorageInfo;700701 function processSettings(settings) {702 var themeClass = "editorTheme"; //$NON-NLS-0$703 var theme = mTextTheme.TextTheme.getTheme();704 theme.setThemeClass(themeClass, theme.buildStyleSheet(themeClass, settings));705 }706 ThemeData.prototype.processSettings = processSettings;707708 return {709 ThemeData: ThemeData,710 getStyles: getStyles,711 getDefaultTheme: getDefaultTheme712 };713 }
...
transparent.js
Source:transparent.js
1/*2Template Name: Color Admin - Responsive Admin Dashboard Template build with Twitter Bootstrap 3 & 43Version: 4.0.04Author: Sean Ngu5Website: http://www.seantheme.com/color-admin-v4.0/admin/6*/7var FONT_COLOR = 'rgba(255,255,255,0.5)';8var FONT_FAMILY = '-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"';9var FONT_WEIGHT = '500';10var FONT_SIZE = '12px';11var COLOR_BLUE = '#006cff';12var COLOR_BLUE_LIGHTER = '#4091ff';13var COLOR_BLUE_DARKER = '#0051bf';14var COLOR_BLUE_TRANSPARENT_1 = 'rgba(0, 108, 255, 0.1)';15var COLOR_BLUE_TRANSPARENT_2 = 'rgba(0, 108, 255, 0.2)';16var COLOR_BLUE_TRANSPARENT_3 = 'rgba(0, 108, 255, 0.3)';17var COLOR_BLUE_TRANSPARENT_4 = 'rgba(0, 108, 255, 0.4)';18var COLOR_BLUE_TRANSPARENT_5 = 'rgba(0, 108, 255, 0.5)';19var COLOR_BLUE_TRANSPARENT_6 = 'rgba(0, 108, 255, 0.6)';20var COLOR_BLUE_TRANSPARENT_7 = 'rgba(0, 108, 255, 0.7)';21var COLOR_BLUE_TRANSPARENT_8 = 'rgba(0, 108, 255, 0.8)';22var COLOR_BLUE_TRANSPARENT_9 = 'rgba(0, 108, 255, 0.9)';23var COLOR_AQUA = '#00cbff';24var COLOR_AQUA_LIGHTER = '#40d8ff';25var COLOR_AQUA_DARKER = '#0098bf';26var COLOR_AQUA_TRANSPARENT_1 = 'rgba(0, 203, 255, 0.1)';27var COLOR_AQUA_TRANSPARENT_2 = 'rgba(0, 203, 255, 0.2)';28var COLOR_AQUA_TRANSPARENT_3 = 'rgba(0, 203, 255, 0.3)';29var COLOR_AQUA_TRANSPARENT_4 = 'rgba(0, 203, 255, 0.4)';30var COLOR_AQUA_TRANSPARENT_5 = 'rgba(0, 203, 255, 0.5)';31var COLOR_AQUA_TRANSPARENT_6 = 'rgba(0, 203, 255, 0.6)';32var COLOR_AQUA_TRANSPARENT_7 = 'rgba(0, 203, 255, 0.7)';33var COLOR_AQUA_TRANSPARENT_8 = 'rgba(0, 203, 255, 0.8)';34var COLOR_AQUA_TRANSPARENT_9 = 'rgba(0, 203, 255, 0.9)';35 36var COLOR_GREEN = '#04c142';37var COLOR_GREEN_LIGHTER = '#43d171';38var COLOR_GREEN_DARKER = '#039131';39var COLOR_GREEN_TRANSPARENT_1 = 'rgba(4, 193, 66, 0.1)';40var COLOR_GREEN_TRANSPARENT_2 = 'rgba(4, 193, 66, 0.2)';41var COLOR_GREEN_TRANSPARENT_3 = 'rgba(4, 193, 66, 0.3)';42var COLOR_GREEN_TRANSPARENT_4 = 'rgba(4, 193, 66, 0.4)';43var COLOR_GREEN_TRANSPARENT_5 = 'rgba(4, 193, 66, 0.5)';44var COLOR_GREEN_TRANSPARENT_6 = 'rgba(4, 193, 66, 0.6)';45var COLOR_GREEN_TRANSPARENT_7 = 'rgba(4, 193, 66, 0.7)';46var COLOR_GREEN_TRANSPARENT_8 = 'rgba(4, 193, 66, 0.8)';47var COLOR_GREEN_TRANSPARENT_9 = 'rgba(4, 193, 66, 0.9)';48var COLOR_YELLOW = '#ffd900';49var COLOR_YELLOW_LIGHTER = '#fde248';50var COLOR_YELLOW_DARKER = '#bfa300';51var COLOR_YELLOW_TRANSPARENT_1 = 'rgba(255, 217, 0, 0.1)';52var COLOR_YELLOW_TRANSPARENT_2 = 'rgba(255, 217, 0, 0.2)';53var COLOR_YELLOW_TRANSPARENT_3 = 'rgba(255, 217, 0, 0.3)';54var COLOR_YELLOW_TRANSPARENT_4 = 'rgba(255, 217, 0, 0.4)';55var COLOR_YELLOW_TRANSPARENT_5 = 'rgba(255, 217, 0, 0.5)';56var COLOR_YELLOW_TRANSPARENT_6 = 'rgba(255, 217, 0, 0.6)';57var COLOR_YELLOW_TRANSPARENT_7 = 'rgba(255, 217, 0, 0.7)';58var COLOR_YELLOW_TRANSPARENT_8 = 'rgba(255, 217, 0, 0.8)';59var COLOR_YELLOW_TRANSPARENT_9 = 'rgba(255, 217, 0, 0.9)';60 61var COLOR_ORANGE = '#ff7b01';62var COLOR_ORANGE_LIGHTER= '#ff9c41';63var COLOR_ORANGE_DARKER = '#bf5c01';64var COLOR_ORANGE_TRANSPARENT_1 = 'rgba(255, 123, 1, 0.1)';65var COLOR_ORANGE_TRANSPARENT_2 = 'rgba(255, 123, 1, 0.2)';66var COLOR_ORANGE_TRANSPARENT_3 = 'rgba(255, 123, 1, 0.3)';67var COLOR_ORANGE_TRANSPARENT_4 = 'rgba(255, 123, 1, 0.4)';68var COLOR_ORANGE_TRANSPARENT_5 = 'rgba(255, 123, 1, 0.5)';69var COLOR_ORANGE_TRANSPARENT_6 = 'rgba(255, 123, 1, 0.6)';70var COLOR_ORANGE_TRANSPARENT_7 = 'rgba(255, 123, 1, 0.7)';71var COLOR_ORANGE_TRANSPARENT_8 = 'rgba(255, 123, 1, 0.8)';72var COLOR_ORANGE_TRANSPARENT_9 = 'rgba(255, 123, 1, 0.9)';73 74var COLOR_PURPLE = '#9800ff';75var COLOR_PURPLE_LIGHTER= '#b240ff';76var COLOR_PURPLE_DARKER = '#7200bf';77var COLOR_PURPLE_TRANSPARENT_1 = 'rgba(152, 0, 255, 0.1)';78var COLOR_PURPLE_TRANSPARENT_2 = 'rgba(152, 0, 255, 0.2)';79var COLOR_PURPLE_TRANSPARENT_3 = 'rgba(152, 0, 255, 0.3)';80var COLOR_PURPLE_TRANSPARENT_4 = 'rgba(152, 0, 255, 0.4)';81var COLOR_PURPLE_TRANSPARENT_5 = 'rgba(152, 0, 255, 0.5)';82var COLOR_PURPLE_TRANSPARENT_6 = 'rgba(152, 0, 255, 0.6)';83var COLOR_PURPLE_TRANSPARENT_7 = 'rgba(152, 0, 255, 0.7)';84var COLOR_PURPLE_TRANSPARENT_8 = 'rgba(152, 0, 255, 0.8)';85var COLOR_PURPLE_TRANSPARENT_9 = 'rgba(152, 0, 255, 0.9)';86var COLOR_RED = '#ff3502';87var COLOR_RED_LIGHTER = '#ff6841';88var COLOR_RED_DARKER = '#bf2801';89var COLOR_RED_TRANSPARENT_1 = 'rgba(255, 53, 2, 0.1)';90var COLOR_RED_TRANSPARENT_2 = 'rgba(255, 53, 2, 0.2)';91var COLOR_RED_TRANSPARENT_3 = 'rgba(255, 53, 2, 0.3)';92var COLOR_RED_TRANSPARENT_4 = 'rgba(255, 53, 2, 0.4)';93var COLOR_RED_TRANSPARENT_5 = 'rgba(255, 53, 2, 0.5)';94var COLOR_RED_TRANSPARENT_6 = 'rgba(255, 53, 2, 0.6)';95var COLOR_RED_TRANSPARENT_7 = 'rgba(255, 53, 2, 0.7)';96var COLOR_RED_TRANSPARENT_8 = 'rgba(255, 53, 2, 0.8)';97var COLOR_RED_TRANSPARENT_9 = 'rgba(255, 53, 2, 0.9)';98var COLOR_GREY = '#999999';99var COLOR_GREY_LIGHTER = '#b3b3b3';100var COLOR_GREY_DARKER = '#737373';101var COLOR_GREY_TRANSPARENT_1 = 'rgba(182, 194, 201, 0.1)';102var COLOR_GREY_TRANSPARENT_2 = 'rgba(182, 194, 201, 0.2)';103var COLOR_GREY_TRANSPARENT_3 = 'rgba(182, 194, 201, 0.3)';104var COLOR_GREY_TRANSPARENT_4 = 'rgba(182, 194, 201, 0.4)';105var COLOR_GREY_TRANSPARENT_5 = 'rgba(182, 194, 201, 0.5)';106var COLOR_GREY_TRANSPARENT_6 = 'rgba(182, 194, 201, 0.6)';107var COLOR_GREY_TRANSPARENT_7 = 'rgba(182, 194, 201, 0.7)';108var COLOR_GREY_TRANSPARENT_8 = 'rgba(182, 194, 201, 0.8)';109var COLOR_GREY_TRANSPARENT_9 = 'rgba(182, 194, 201, 0.9)';110 111var COLOR_SILVER = '#f0f3f4';112var COLOR_SILVER_LIGHTER= '#f4f6f7';113var COLOR_SILVER_DARKER = '#b4b6b7';114var COLOR_SILVER_TRANSPARENT_1 = 'rgba(240, 243, 244, 0.1)';115var COLOR_SILVER_TRANSPARENT_2 = 'rgba(240, 243, 244, 0.2)';116var COLOR_SILVER_TRANSPARENT_3 = 'rgba(240, 243, 244, 0.3)';117var COLOR_SILVER_TRANSPARENT_4 = 'rgba(240, 243, 244, 0.4)';118var COLOR_SILVER_TRANSPARENT_5 = 'rgba(240, 243, 244, 0.5)';119var COLOR_SILVER_TRANSPARENT_6 = 'rgba(240, 243, 244, 0.6)';120var COLOR_SILVER_TRANSPARENT_7 = 'rgba(240, 243, 244, 0.7)';121var COLOR_SILVER_TRANSPARENT_8 = 'rgba(240, 243, 244, 0.8)';122var COLOR_SILVER_TRANSPARENT_9 = 'rgba(240, 243, 244, 0.9)';123var COLOR_BLACK = '#333333';124var COLOR_BLACK_LIGHTER = '#666666';125var COLOR_BLACK_DARKER = '#262626';126var COLOR_BLACK_TRANSPARENT_1 = 'rgba(51, 51, 51, 0.1)';127var COLOR_BLACK_TRANSPARENT_2 = 'rgba(51, 51, 51, 0.2)';128var COLOR_BLACK_TRANSPARENT_3 = 'rgba(51, 51, 51, 0.3)';129var COLOR_BLACK_TRANSPARENT_4 = 'rgba(51, 51, 51, 0.4)';130var COLOR_BLACK_TRANSPARENT_5 = 'rgba(51, 51, 51, 0.5)';131var COLOR_BLACK_TRANSPARENT_6 = 'rgba(51, 51, 51, 0.6)';132var COLOR_BLACK_TRANSPARENT_7 = 'rgba(51, 51, 51, 0.7)';133var COLOR_BLACK_TRANSPARENT_8 = 'rgba(51, 51, 51, 0.8)';134var COLOR_BLACK_TRANSPARENT_9 = 'rgba(51, 51, 51, 0.9)';135var COLOR_WHITE = '#FFFFFF';136var COLOR_WHITE_TRANSPARENT_1 = 'rgba(255, 255, 255, 0.1)';137var COLOR_WHITE_TRANSPARENT_2 = 'rgba(255, 255, 255, 0.2)';138var COLOR_WHITE_TRANSPARENT_3 = 'rgba(255, 255, 255, 0.3)';139var COLOR_WHITE_TRANSPARENT_4 = 'rgba(255, 255, 255, 0.4)';140var COLOR_WHITE_TRANSPARENT_5 = 'rgba(255, 255, 255, 0.5)';141var COLOR_WHITE_TRANSPARENT_6 = 'rgba(255, 255, 255, 0.6)';142var COLOR_WHITE_TRANSPARENT_7 = 'rgba(255, 255, 255, 0.7)';143var COLOR_WHITE_TRANSPARENT_8 = 'rgba(255, 255, 255, 0.8)';...
color-scheme-control.js
Source:color-scheme-control.js
1/* global colorScheme, Color */2/**3 * Add a listener to the Color Scheme control to update other color controls to new values/defaults.4 * Also trigger an update of the Color Scheme CSS when a color is changed.5 */6( function( api ) {7 var cssTemplate = wp.template( 'twentysixteen-color-scheme' ),8 colorSchemeKeys = [9 'background_color',10 'page_background_color',11 'link_color',12 'main_text_color',13 'secondary_text_color'14 ],15 colorSettings = [16 'background_color',17 'page_background_color',18 'link_color',19 'main_text_color',20 'secondary_text_color'21 ];22 api.controlConstructor.select = api.Control.extend( {23 ready: function() {24 if ( 'color_scheme' === this.id ) {25 this.setting.bind( 'change', function( value ) {26 var colors = colorScheme[value].colors;27 // Update Background Color.28 var color = colors[0];29 api( 'background_color' ).set( color );30 api.control( 'background_color' ).container.find( '.color-picker-hex' )31 .data( 'data-default-color', color )32 .wpColorPicker( 'defaultColor', color );33 // Update Page Background Color.34 color = colors[1];35 api( 'page_background_color' ).set( color );36 api.control( 'page_background_color' ).container.find( '.color-picker-hex' )37 .data( 'data-default-color', color )38 .wpColorPicker( 'defaultColor', color );39 // Update Link Color.40 color = colors[2];41 api( 'link_color' ).set( color );42 api.control( 'link_color' ).container.find( '.color-picker-hex' )43 .data( 'data-default-color', color )44 .wpColorPicker( 'defaultColor', color );45 // Update Main Text Color.46 color = colors[3];47 api( 'main_text_color' ).set( color );48 api.control( 'main_text_color' ).container.find( '.color-picker-hex' )49 .data( 'data-default-color', color )50 .wpColorPicker( 'defaultColor', color );51 // Update Secondary Text Color.52 color = colors[4];53 api( 'secondary_text_color' ).set( color );54 api.control( 'secondary_text_color' ).container.find( '.color-picker-hex' )55 .data( 'data-default-color', color )56 .wpColorPicker( 'defaultColor', color );57 } );58 }59 }60 } );61 // Generate the CSS for the current Color Scheme.62 function updateCSS() {63 var scheme = api( 'color_scheme' )(),64 css,65 colors = _.object( colorSchemeKeys, colorScheme[ scheme ].colors );66 // Merge in color scheme overrides.67 _.each( colorSettings, function( setting ) {68 colors[ setting ] = api( setting )();69 } );70 // Add additional color.71 // jscs:disable72 colors.border_color = Color( colors.main_text_color ).toCSS( 'rgba', 0.2 );73 // jscs:enable74 css = cssTemplate( colors );75 api.previewer.send( 'update-color-scheme-css', css );76 }77 // Update the CSS whenever a color setting is changed.78 _.each( colorSettings, function( setting ) {79 api( setting, function( setting ) {80 setting.bind( updateCSS );81 } );82 } );...
Using AI Code Generation
1const { color } = require('taiko');2const { color } = require('taiko');3const { color } = require('taiko');4const { color } = require('taiko');5const { color } = require('taiko');6const { color } = require('taiko');
Using AI Code Generation
1const { openBrowser, goto, click, closeBrowser, color } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 await click("Gmail");7 await click("Sign in");8 await click("Forgot email?");9 await click("Next");10 await click("Create account");11 await click("Next");12 await click("Terms");13 await click("Privacy");14 await click("Help");15 await click("Send feedback");16 await click("Google apps");17 await click("Gmail");18 await click("Sign in");19 await click("Forgot email?");20 await click("Next");21 await click("Create account");22 await click("Next");23 await click("Terms");24 await click("Privacy");25 await click("Help");26 await click("Send feedback");27 await click("Google apps");28 await click("Gmail");29 await click("Sign in");30 await click("Forgot email?");31 await click("Next");32 await click("Create account");33 await click("Next");34 await click("Terms");35 await click("Privacy");36 await click("Help");37 await click("Send feedback");38 await click("Google apps");39 await click("Gmail");40 await click("Sign in");41 await click("Forgot email?");42 await click("Next");43 await click("Create account");44 await click("Next");45 await click("Terms");46 await click("Privacy");47 await click("Help");48 await click("Send feedback");49 await click("Google apps");50 await click("Gmail");51 await click("Sign in");52 await click("Forgot email?");53 await click("Next");54 await click("Create account");55 await click("Next");56 await click("Terms");57 await click("Privacy");58 await click("Help");59 await click("Send feedback");60 await click("Google apps");61 await click("Gmail");62 await click("Sign in");63 await click("Forgot email?");64 await click("Next");65 await click("Create account");66 await click("Next");67 await click("Terms");68 await click("Privacy");69 await click("Help");70 await click("Send feedback");71 await click("Google apps");72 await click("Gmail");73 await click("Sign in");74 await click("Forgot email?");75 await click("Next");
Using AI Code Generation
1const { openBrowser, goto, color, closeBrowser } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 let colorValue = await color({id:'hplogo'});7 console.log(colorValue);8 } catch (e) {9 console.error(e);10 } finally {11 await closeBrowser();12 }13})();14### consoleMessage(message)15const { openBrowser, goto, consoleMessage, closeBrowser } = require('taiko');16(async () => {17 try {18 await openBrowser();19 await goto("google.com");20 let consoleMsg = await consoleMessage();21 console.log(consoleMsg);22 } catch (e) {23 console.error(e);24 } finally {25 await closeBrowser();26 }27})();28### click(selector, options)29const { openBrowser, goto, click, closeBrowser } = require('taiko');30(async () => {31 try {32 await openBrowser();33 await goto("google.com");34 await click("Gmail");35 } catch (e) {36 console.error(e);37 } finally {38 await closeBrowser();39 }40})();41### clickLink(linkText, options)42const { openBrowser, goto, clickLink, closeBrowser } = require('taiko');43(async () => {44 try {45 await openBrowser();46 await goto("google.com");47 await clickLink("Gmail");48 } catch (e) {49 console.error(e);50 } finally {51 await closeBrowser();52 }53})();54### closeBrowser()55const { openBrowser, goto, closeBrowser } = require('taiko');56(async () => {57 try {
Using AI Code Generation
1const { openBrowser, goto, closeBrowser, color } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 await color("Google").exists();7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();13We welcome contributions. Please read our [contributing guide](
Using AI Code Generation
1const { openBrowser, goto, closeBrowser, color } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 await color("Google Search").exists();7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();13const { openBrowser, goto, closeBrowser, color } = require('taiko');14(async () => {15 try {16 await openBrowser();17 await goto("google.com");18 await color("Google Search").exists();19 } catch (e) {20 console.error(e);21 } finally {22 await closeBrowser();23 }24})();25We welcome contributions to Taiko. Please read the [contributing guide](
Using AI Code Generation
1const { openBrowser, goto, closeBrowser, color } = require('taiko');2(async () => {3 try {4 await openBrowser();5 await goto("google.com");6 console.log(color("This is a blue color text", "blue"));7 } catch (e) {8 console.error(e);9 } finally {10 await closeBrowser();11 }12})();13### waitFor(timeInMilliSeconds)14const { openBrowser, goto, closeBrowser, waitFor } = require('taiko');15(async () => {16 try {17 await openBrowser();18 await goto("google.com");19 await waitFor(2000);20 } catch (e) {21 console.error(e);22 } finally {23 await closeBrowser();24 }25})();26### accept()27const { openBrowser, goto, closeBrowser, accept } = require('taiko');28(async () => {29 try {30 await openBrowser();31 await goto("google.com");32 await accept();33 } catch (e) {34 console.error(e);35 } finally {36 await closeBrowser();37 }38})();39### dismiss()40const { openBrowser, goto, closeBrowser, dismiss } = require('taiko');41(async () => {42 try {43 await openBrowser();44 await goto("google.com");45 await dismiss();46 } catch (e) {47 console.error(e);48 } finally {49 await closeBrowser();50 }51})();52### prompt(text)53const { openBrowser, goto, closeBrowser, prompt } = require('taiko');54(async () => {55 try {56 await openBrowser();57 await goto("google.com");58 await prompt("Taiko");59 } catch (e) {60 console.error(e);61 } finally {62 await closeBrowser();63 }64})();65### textBox(options)
Using AI Code Generation
1color('red');2color('red', 'green');3color('red', 'green', 'blue');4color('red', 'green', 'blue', 'alpha');5color('red', 'green', 'blue', 'alpha', 'hue');6color('red', 'green', 'blue', 'alpha', 'hue', 'saturation');7color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness');8color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness');9color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness');10color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray');11color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2');12color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2', 'green2');13color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2', 'green2', 'blue2');14color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2', 'green2', 'blue2', 'alpha2');15color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2', 'green2', 'blue2', 'alpha2', 'hue2');16color('red', 'green', 'blue', 'alpha', 'hue', 'saturation', 'lightness', 'whiteness', 'blackness', 'gray', 'red2', 'green2', 'blue2', 'alpha2', 'hue2', 'saturation2');17color('red', '
Using AI Code Generation
1const { color } = require('taiko');2color(255, 255, 255);3color(0, 0, 0);4color(255, 0, 0);5color(0, 255, 0);6color(0, 0, 255);7color(255, 255, 0);8color(0, 255, 255);9color(255, 0, 255);10color(192, 192, 192);11color(128, 128, 128);12color(128, 0, 0);13color(128, 128, 0);14color(0, 128, 0);15color(128, 0, 128);16color(0, 128, 128);17color(0, 0, 128);18color(255, 165, 0);19color(255, 69, 0);20color(255, 215, 0);21color(218, 165, 32);22color(184, 134, 11);23color(189, 183, 107);24color(240, 230, 140);25color(238, 232, 170);26color(250, 250, 210);27color(255, 255, 224);28color(255, 250, 205);29color(255, 239, 213);30color(255, 228, 196);31color(255, 218, 185);32color(255, 222, 173);33color(245, 222, 179);34color(244, 164, 96);35color(210, 180, 140);36color(222, 184, 135);37color(210, 105, 30);38color(205, 133, 63);39color(244, 164, 96);40color(210, 180, 140);41color(222, 184, 135);42color(210, 105, 30);43color(205, 133, 63);44color(139, 69, 19);45color(160, 82, 45);46color(233, 150, 122);47color(250, 128, 114);48color(255, 160, 122);49color(255, 99,
Using AI Code Generation
1const { color } = require('taiko');2const assert = require('assert');3(async () => {4 try {5 assert.equal(color('rgb(255, 0, 0)').toHex(), '#ff0000');6 assert.equal(color('rgb(0, 255, 0)').toHex(), '#00ff00');7 assert.equal(color('rgb(0, 0, 255)').toHex(), '#0000ff');8 } catch (e) {9 console.error(e);10 } finally {11 closeBrowser();12 }13})();14const { openBrowser, goto, click, below, closeBrowser } = require('taiko');15(async () => {16 try {17 await openBrowser();18 await goto("google.com");19 await click("Sign in");20 await click("Create account", below("Sign in"));21 } catch (e) {22 console.error(e);23 } finally {24 await closeBrowser();25 }26})();27const { openBrowser, goto, write, closeBrowser } = require('taiko');28(async () => {29 try {30 await openBrowser();31 await goto("google.com");32 await write("Taiko", into("Search"));33 } catch (e) {34 console.error(e);35 } finally {36 await closeBrowser();37 }38})();39const { openBrowser, goto, text, closeBrowser } = require('taiko');40(async () => {41 try {42 await openBrowser();43 await goto("google.com");44 await text("Google offered in").exists();45 } catch (e) {46 console.error(e);47 } finally {48 await closeBrowser();49 }50})();51const { openBrowser, goto, dropDown, closeBrowser } = require('taiko');52(async () => {53 try {54 await openBrowser();55 await goto("google.com");56 await dropDown({ id: "lang-chooser" }).select("हिन्दी");57 } catch (e) {58 console.error(e);59 } finally {60 await closeBrowser();61 }62})();63const { openBrowser, goto, table
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!