Created
September 1, 2014 16:27
-
-
Save mattdesl/ebbcd9b3967dae275557 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rgb2hsl = require('./rgb2hsl') | |
var palette = require('./palette')(options) | |
//e.g. | |
console.log( rgb2hsl([255,0,255]) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Palette(options) { | |
//this line allows somebody to just require('palette')(opts) instead of | |
//always needing to call new Palette(opts) | |
//it's optional, but I find it leads to cleaner code | |
if (!(this instanceof Palette)) return new Palette(options) | |
options = options||{} | |
... do something here ... | |
} | |
module.exports = Palette |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function rgb2hsl(rgb) { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment