1 /** 2 * @class color 3 * @description 4 * Holds a standard RGBA value. See {@link sandboxe.color.create} to instantiate 5 * it. </br></br> 6 * 7 * colors are sandboxe's primitive color type. Each component holds byte values 8 * but are expressed as decimals from 0.0 (no intensity) to 1.0 (maximum intensity). 9 * 10 * A notable feature is that components or arguments that except colors may 11 * also accept string values as if calling {@link color.set}. 12 * 13 */ 14 function color() { 15 16 17 /** 18 * Converts the color into a string. 19 * @returns {String} 20 */ 21 this.toString = function(){}; 22 23 /** 24 * Creates a copy of this color. 25 * @returns {color} 26 */ 27 this.clone = function(){}; 28 29 /** 30 * Sets the color from a string value or color. 31 * String values accepted can follow one of 2 formats: </br></br> 32 * 1.) As a color name (see this list https://en.wikipedia.org/wiki/X11_color_names) </br> 33 * 2.) As a typical hex html / css style format color (i.e. #ff00ff). Alpha channel may be included in this hex string. 34 * @param {String|color} value The new value to set. 35 */ 36 this.set = function(value){}; 37 38 39 40 /** 41 * Red component. Defined from 0.0 to 1.0 42 * @type {Number} 43 */ 44 this.r = {}; 45 46 /** 47 * Green component. Defined from 0.0 to 1.0 48 * @type {Number} 49 */ 50 this.g = {}; 51 52 /** 53 * Blue component. Defined from 0.0 to 1.0 54 * @type {Number} 55 */ 56 this.b = {}; 57 58 /** 59 * Alpha/opacity component. Defined from 0.0 to 1.0 60 * @type {Number} 61 */ 62 this.a = {}; 63 64 65 66 67 68 /** 69 * Alias for color.r 70 * @type {Number} 71 */ 72 this.red = {}; 73 74 /** 75 * Alias for color.g 76 * @type {Number} 77 */ 78 this.green = {}; 79 80 /** 81 * Alias for color.b 82 * @type {Number} 83 */ 84 this.blue = {}; 85 86 /** 87 * Alias for color.a 88 * @type {Number} 89 */ 90 this.alpha = {}; 91 92 return this; 93 }