Skip to content

Instantly share code, notes, and snippets.

@evaldasg
Last active July 9, 2016 12:18
Show Gist options
  • Save evaldasg/3cc9cef79a410660df2702cbe9e50efd to your computer and use it in GitHub Desktop.
Save evaldasg/3cc9cef79a410660df2702cbe9e50efd to your computer and use it in GitHub Desktop.
Print out to the console terminal's 256 width colors.
#!/usr/bin/env ruby
# This prints to the console 256 colors for foreground & background
%w(38 48).each do |fgbg| # Foreground/Background
(0..256).each do |color|
print "\e[#{fgbg};5;#{color}m" + " #{color}".ljust(8, ' ') + "\e[0m"
print "\n" if (color + 1) % 10 == 0
end
print "\n\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment