Skip to content

Commit

Permalink
add color example + return early
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenlacy committed May 17, 2016
1 parent 6a80818 commit c38fa6a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});

Expand Down
14 changes: 14 additions & 0 deletions examples/color.js
Original file line number Diff line number Diff line change
@@ -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'
});
10 changes: 5 additions & 5 deletions lib/findKeyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

/**
Expand Down

0 comments on commit c38fa6a

Please sign in to comment.