Created
April 4, 2021 12:42
-
-
Save ayosec/900b75fc5a6bd7b161cefc7f825705d0 to your computer and use it in GitHub Desktop.
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
#!/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