From 2818b3dd8b51c6a0bf74c7d4fbecf844efaef05b Mon Sep 17 00:00:00 2001 From: Jesper Grann Laursen Date: Sun, 27 Mar 2022 23:16:32 +0200 Subject: [PATCH] Check for degamma enabled before applying (#27) (#30) Co-authored-by: Jesper Grann Laursen --- 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)