aboutsummaryrefslogtreecommitdiff
path: root/editor/scripts/color.js
diff options
context:
space:
mode:
authorneauoire <aliceffekt@gmail.com>2019-11-09 11:43:43 -0500
committerneauoire <aliceffekt@gmail.com>2019-11-09 11:43:43 -0500
commitf9693c85cc13e5e9b5e6f5cd400d1c0784a44a11 (patch)
tree7642bb17264951eecb68555c80c6c02e5c7d8af4 /editor/scripts/color.js
parentf7e20d0ae0273dbb9bc2c86a4715e53707279aee (diff)
*
Diffstat (limited to 'editor/scripts/color.js')
-rw-r--r--editor/scripts/color.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/editor/scripts/color.js b/editor/scripts/color.js
index 3aebfc7..0c52018 100644
--- a/editor/scripts/color.js
+++ b/editor/scripts/color.js
@@ -15,9 +15,9 @@ function Color (hex = '#000000') {
this.invert = { r: 255 - this.rgb.r, g: 255 - this.rgb.g, b: 255 - this.rgb.b }
this.contrast = function (b) {
- const a_lum = 0.2126 * _linear(this.r / 256) + 0.7152 * _linear(this.g / 256) + 0.0722 * _linear(this.b / 256)
- const b_lum = 0.2126 * _linear(b.r / 256) + 0.7152 * _linear(b.g / 256) + 0.0722 * _linear(b.b / 256)
- return a_lum > b_lum ? (a_lum + 0.05) / (b_lum + 0.05) : (b_lum + 0.05) / (a_lum + 0.05)
+ const lumA = 0.2126 * _linear(this.r / 256) + 0.7152 * _linear(this.g / 256) + 0.0722 * _linear(this.b / 256)
+ const lumB = 0.2126 * _linear(b.r / 256) + 0.7152 * _linear(b.g / 256) + 0.0722 * _linear(b.b / 256)
+ return lumA > lumB ? (lumA + 0.05) / (lumB + 0.05) : (lumB + 0.05) / (lumA + 0.05)
}
this.rgba = function () {