Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

nearly works I guess

  • Loading branch information...
commit 104dcfa94811c2a837331f81ebc019f9c23c6dc0 0 parents
@substack authored
Showing with 93 additions and 0 deletions.
  1. +2 −0  README.markdown
  2. +52 −0 index.js
  3. +39 −0 package.json
2  README.markdown
@@ -0,0 +1,2 @@
+Mr. Color
+=========
52 index.js
@@ -0,0 +1,52 @@
+var convert = require('color-convert');
+
+var mr = module.exports = function () {
+ return (function next (min, max) {
+ var i = min;
+ var x = mr.fromIndex(i);
+
+ x.next = function () {
+ var j = Math.floor((max - min) / 2 + min);
+ var y = mr.fromIndex(j);
+ y.next = function () {
+ return next(Math.floor(i + (max - i) / 2 + i), max);
+ };
+ return y;
+ };
+
+ return x;
+ })(0, 360);
+};
+
+mr.take = function (n) {
+ var xs = [];
+ var c = { next : mr };
+
+ for (var i = 0; i < n; i++) {
+ c = c.next();
+ xs.push(c);
+ }
+
+ return xs;
+};
+
+mr.fromIndex = function (i) {
+ return {
+ index : i,
+ rgb : function () {
+ return convert.hsl2rgb([ i, 100, 50 ])
+ },
+ hsl : function () {
+ return [ i, 100, 50 ];
+ },
+ hsv : function () {
+ return convert.hsl2hsv([ i, 100, 50 ])
+ },
+ cmyk : function () {
+ return convert.hsl2cmyk([ i, 100, 50 ])
+ },
+ xyz : function () {
+ return convert.hsl2xyz([ i, 100, 50 ])
+ }
+ };
+};
39 package.json
@@ -0,0 +1,39 @@
+{
+ "name" : "mrcolor",
+ "version" : "0.0.0",
+ "description" : "Just give me some colors already!",
+ "main" : "index.js",
+ "directories" : {
+ "lib" : ".",
+ "example" : "example",
+ "test" : "test"
+ },
+ "dependencies" : {
+ "color-convert" : "0.2.x"
+ },
+ "devDependencies" : {
+ "expresso" : "0.7.x"
+ },
+ "scripts" : {
+ "test" : "expresso"
+ },
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/substack/node-mrcolor.git"
+ },
+ "keywords" : [
+ "color",
+ "pallet",
+ "palette",
+ "design"
+ ],
+ "author" : {
+ "name" : "James Halliday",
+ "email" : "mail@substack.net",
+ "url" : "http://substack.net"
+ },
+ "license" : "MIT/X11",
+ "engine" : {
+ "node" : ">=0.4"
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.