Skip to content

Instantly share code, notes, and snippets.

@zaftzaft
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save zaftzaft/b03dc99d9fdf42a6d7d4 to your computer and use it in GitHub Desktop.

Select an option

Save zaftzaft/b03dc99d9fdf42a6d7d4 to your computer and use it in GitHub Desktop.
ansi 256
var pad = function(n){
return n < 10 ? "00" + n : n < 100 ? "0" + n : n;
}
var x = 6;
for(var i = 0;i < x;i++){
var s = "";
for(var c = 0;c < 240 / x;c++){
var d = i + (c * x) + 16;
s += ("\x1b[38;5;" + d + "m" + pad(d));
}
console.log(s);
console.log("\x1b[39;49m");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment