Last active
April 6, 2016 20:38
-
-
Save laughinghan/d60166aecb96c63022b3654ac6a71fef to your computer and use it in GitHub Desktop.
This file contains hidden or 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
chroma('#bef').hcl(); | |
function hcl(h, c, l) { | |
var a = chroma.hcl(h, c, l).hcl() | |
var dh = Math.abs(h - a[0]) | |
var dc = Math.abs(c - a[1]) | |
var dl = Math.abs(l - a[2]) | |
return [ | |
chroma.hcl(h, c, l), | |
Math.sqrt(dh*dh + dc*dc + dl*dl), | |
h, | |
Math.max(dh, dc, dl), | |
] | |
} | |
var c = 10, l = 92; | |
hcl(17, c, l); | |
hcl(215, c, l); | |
hcl(227, c, l); | |
hcl(248, c, l); | |
hcl(270, c, l); | |
var colors = [], dists = 0, h = 0; | |
while (h < 360) { | |
var color = hcl(h, c, l) | |
colors.push(color[0]+'') | |
dists += color[1] | |
h += .1 | |
} | |
dists/colors.length; | |
var hash = {}; | |
colors.forEach(function(c) { hash[c] = 1 }); | |
Object.keys(hash).length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment