Skip to content

Instantly share code, notes, and snippets.

@ayosec
Created April 4, 2021 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayosec/900b75fc5a6bd7b161cefc7f825705d0 to your computer and use it in GitHub Desktop.
Save ayosec/900b75fc5a6bd7b161cefc7f825705d0 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
256.times do |color|
if color < 7 || (color > 15 && (color - 16) % 36 < 18)
fg = 231
else
fg = 0
end
print "\e[38;5;#{fg};48;5;#{color}m #{color.to_s.rjust(3)} \e[m"
if (color >= 15 && color < 232 && (color - 15) % 18 == 0) || (color > 231 && (color - 15) % 12 == 0)
puts
end
puts if color == 15 || color == 231
end
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment