Created
April 17, 2014 12:46
-
-
Save tmd45/10980663 to your computer and use it in GitHub Desktop.
ターミナルで使える色と色番号を一覧にする ref: http://qiita.com/tmd45/items/226e7c380453809bc62a
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
# -*- coding: utf-8 -*- | |
@fg = "\x1b[38;5;" | |
@bg = "\x1b[48;5;" | |
@rs = "\x1b[0m" | |
def color(code) | |
number = '%3d' % code | |
"#{@bg}#{code}m #{number}#{@rs}#{@fg}#{code}m #{number}#{@rs} " | |
end | |
256.times do |n| | |
print color(n) | |
print "\n" if (n + 1).modulo(8).zero? | |
end | |
print "\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment