diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-06-18 00:51:50 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-06-18 00:51:50 +0200 |
commit | cb3869dce7f2cb179240ac6e0653cbfd94e4d0e8 (patch) | |
tree | 414a344f606971652336b83c19b53a51b6c50642 /lib/color.js | |
parent | a22c903e5e641fb6ed0efb03acae12fa90d86d04 (diff) | |
download | bugzilla-triage-cb3869dce7f2cb179240ac6e0653cbfd94e4d0e8.tar.gz |
Write HACKING document with coding guidelines and actually fix the
code to follow it.
Diffstat (limited to 'lib/color.js')
-rw-r--r-- | lib/color.js | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/color.js b/lib/color.js index 2da2fa7..9a09707 100644 --- a/lib/color.js +++ b/lib/color.js @@ -38,9 +38,9 @@ Color.prototype.hs = function(nStr) { }; Color.prototype.toString = function() { - let rH = Number(this.r.toFixed()).toString(16); - let gH = Number(this.g.toFixed()).toString(16); - let bH = Number(this.b.toFixed()).toString(16); + var rH = Number(this.r.toFixed()).toString(16); + var gH = Number(this.g.toFixed()).toString(16); + var bH = Number(this.b.toFixed()).toString(16); return "#" + this.hs(rH) + this.hs(gH) + this.hs(bH); }; @@ -55,16 +55,16 @@ Color.prototype.toString = function() { * @return Array The HSL representation */ Color.prototype.hsl = function() { - let r = this.r / 255; - let g = this.g / 255; - let b = this.b / 255; - let max = Math.max(r, g, b), min = Math.min(r, g, b); - let h, s, l = (max + min) / 2; + var r = this.r / 255; + var g = this.g / 255; + var b = this.b / 255; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, l = (max + min) / 2; if (max === min) { h = s = 0; // achromatic } else { - let d = max - min; + var d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); switch (max) { case r: @@ -113,13 +113,13 @@ Color.prototype.hslToRgb = function(h, s, l) { return p; } - let r, g, b; + var r, g, b; if (s === 0) { r = g = b = l; // achromatic } else { - let q = l < 0.5 ? l * (1 + s) : l + s - l * s; - let p = 2 * l - q; + var q = l < 0.5 ? l * (1 + s) : l + s - l * s; + var p = 2 * l - q; r = hue2rgb(p, q, h + 1 / 3); g = hue2rgb(p, q, h); b = hue2rgb(p, q, h - 1 / 3); @@ -139,13 +139,13 @@ Color.prototype.hslToRgb = function(h, s, l) { * @return Array The HSV representation */ Color.prototype.hsv = function() { - let r = this.r / 255; - let g = this.g / 255; - let b = this.b / 255; - let max = Math.max(r, g, b), min = Math.min(r, g, b); - let h, s, v = max; + var r = this.r / 255; + var g = this.g / 255; + var b = this.b / 255; + var max = Math.max(r, g, b), min = Math.min(r, g, b); + var h, s, v = max; - let d = max - min; + var d = max - min; s = max === 0 ? 0 : d / max; if (max === min) { @@ -179,13 +179,13 @@ Color.prototype.hsv = function() { * @return Array The RGB representation */ Color.prototype.hsvToRgb = function(h, s, v) { - let r, g, b; + var r, g, b; - let i = Math.floor(h * 6); - let f = h * 6 - i; - let p = v * (1 - s); - let q = v * (1 - f * s); - let t = v * (1 - (1 - f) * s); + var i = Math.floor(h * 6); + var f = h * 6 - i; + var p = v * (1 - s); + var q = v * (1 - f * s); + var t = v * (1 - (1 - f) * s); switch (i % 6) { case 0: @@ -227,10 +227,10 @@ Color.prototype.hsvToRgb = function(h, s, v) { * Provide */ Color.prototype.lightColor = function() { - let hslArray = this.hsl(); - let h = Number(hslArray[0]); - let s = Number(hslArray[1]) * this.Desaturated; - let l = this.Luminosity; - let desA = this.hslToRgb(h, s, l); + var hslArray = this.hsl(); + var h = Number(hslArray[0]); + var s = Number(hslArray[1]) * this.Desaturated; + var l = this.Luminosity; + var desA = this.hslToRgb(h, s, l); return new Color(desA[0], desA[1], desA[2]); }; |