diff --git a/README.md b/README.md index d1b4427..c69af6d 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ var keyboard = require('msi-keyboard')(); // Set left region to high intensity, color red keyboard.color('left', { - color: 'red', + color: 'red', intensity: 'high' }); diff --git a/examples/color.js b/examples/color.js new file mode 100644 index 0000000..9bb029f --- /dev/null +++ b/examples/color.js @@ -0,0 +1,14 @@ +var keyboard = require('../')(); + +keyboard.color('left', { + color: 'red', + intensity: 'high' +}); +keyboard.color('middle', { + color: 'green', + intensity: 'high' +}); +keyboard.color('right', { + color: 'blue', + intensity: 'high' +}); diff --git a/lib/findKeyboard.js b/lib/findKeyboard.js index 910fce1..446f2a3 100644 --- a/lib/findKeyboard.js +++ b/lib/findKeyboard.js @@ -3,15 +3,15 @@ var setColor = require('./setColor'); var setMode = require('./setMode'); var constants = require('./constants'); -module.exports = function(){ +module.exports = function() { var board = new hid.HID(6000, 65280); board.current = {}; - board.color = function(region, obj){ - if (typeof obj === 'string') obj = {color:obj}; - setColor(board, region, obj.color, obj.intensity); - return board; + board.color = function(region, obj) { + if (typeof obj === 'string') obj = {color: obj}; + return setColor(board, region, obj.color, obj.intensity); }; + board.mode = function(mode, left, middle, right, period) { /**