mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Make blink1 (and ledborg) consistent with both docs and cheerlight colours
Close #102
This commit is contained in:
@@ -52,8 +52,9 @@ module.exports = function(RED) {
|
||||
else {
|
||||
// you can add fancy colours by name here if you want...
|
||||
// these are the @cheerlight ones.
|
||||
var colors = {"red":"#FF0000","green":"#00FF00","blue":"#0000FF","cyan":"#00FFFF","white":"#FFFFFF","warmwhite":"#FDF5E6",
|
||||
"purple":"#800080","magenta":"#FF00FF","yellow":"#FFFF00","amber":"#FFD200","orange":"#FFA500","black":"#000000"}
|
||||
var colors = {"red":"#FF0000","green":"#00FF00","blue":"#0000FF","cyan":"#00FFFF",
|
||||
"white":"#FFFFFF","warmwhite":"#FDF5E6","oldlace":"#FDF5E6","purple":"#800080","magenta":"#FF00FF",
|
||||
"yellow":"#FFFF00","amber":"#FFD200","orange":"#FFA500","black":"#000000","pink","#FF69B4"}
|
||||
if (msg.payload.toLowerCase() in colors) {
|
||||
var c = colors[msg.payload.toLowerCase()];
|
||||
r = parseInt(c.slice(1,3),16);
|
||||
@@ -66,12 +67,12 @@ module.exports = function(RED) {
|
||||
node.warn("Blink1 : invalid msg : "+msg.payload);
|
||||
}
|
||||
}
|
||||
} catch (e) { node.warn("Blink1 : error"); blink1 = null; }
|
||||
} catch (e) { node.error("Blink1 : error"); blink1 = null; }
|
||||
}
|
||||
else {
|
||||
node.warn("Blink1 : not found");
|
||||
}
|
||||
} catch (e) { node.warn("Blink1 : device not found"); blink1 = null; }
|
||||
} catch (e) { node.error("Blink1 : device not found"); blink1 = null; }
|
||||
});
|
||||
this.on("close", function() {
|
||||
if (blink1 && typeof blink1.close == "function") {
|
||||
|
Reference in New Issue
Block a user