From 9e9e73937557a9666688354c093c2b5a6728c9af Mon Sep 17 00:00:00 2001 From: Jesper Grann Laursen Date: Thu, 24 Mar 2022 20:38:29 +0100 Subject: [PATCH] Check for degamma enabled before applying (#27) --- lib/busylight.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/busylight.js b/lib/busylight.js index 4538bb5..20a76c3 100644 --- a/lib/busylight.js +++ b/lib/busylight.js @@ -164,9 +164,10 @@ Busylight.prototype.send = function(p){ if(p && p.color !== undefined) { p.color = p.color || this._defaults.color; - this.buffer[positions.red] = degamma(p.color[0]); - this.buffer[positions.green] = degamma(p.color[1]); - this.buffer[positions.blue] = degamma(p.color[2]); + if (this.degamma || this._defaults.degamma) p.color = p.color.map(degamma) + this.buffer[positions.red] = p.color[0]; + this.buffer[positions.green] = p.color[1]; + this.buffer[positions.blue] = p.color[2]; } if(p && p.tone === false)