HueSegments
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
//An example of this can be seen at https://jsfiddle.net/uLzwv8mx/ | |
function HueSegments(steps) { | |
var segments = [] | |
var step | |
var increment = 200/steps | |
for(step = 0; step < steps; step++) { | |
segments.push("hsla("+(Math.floor(increment*step))+", 100%, "+(step % 2 == 0 ? "75" : "50")+"%, 1)") | |
} | |
return segments | |
} | |
//Demo using jQuery | |
var out = $('#Output') | |
HueSegments(10).forEach(function(color) { | |
out.append($('<li>').css({backgroundColor: color})) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment