mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-13 03:12:21 +01:00
add 256-color-test.py
This commit is contained in:
parent
1830b70643
commit
2d70536d4c
1 changed files with 32 additions and 0 deletions
32
256-color-test.py
Executable file
32
256-color-test.py
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Ported to Python from http://www.vim.org/scripts/script.php?script_id=1349
|
||||
|
||||
print "Color indexes should be drawn in bold text of the same color."
|
||||
print
|
||||
|
||||
colored = [0] + [0x5f + 40 * n for n in range(0, 5)]
|
||||
colored_palette = [
|
||||
"%02x/%02x/%02x" % (r, g, b)
|
||||
for r in colored
|
||||
for g in colored
|
||||
for b in colored
|
||||
]
|
||||
|
||||
grayscale = [0x08 + 10 * n for n in range(0, 24)]
|
||||
grayscale_palette = [
|
||||
"%02x/%02x/%02x" % (a, a, a)
|
||||
for a in grayscale
|
||||
]
|
||||
|
||||
normal = "\033[38;5;%sm"
|
||||
bold = "\033[1;38;5;%sm"
|
||||
reset = "\033[0m"
|
||||
|
||||
for (i, color) in enumerate(colored_palette + grayscale_palette, 16):
|
||||
index = (bold + "%4s" + reset) % (i, str(i) + ':')
|
||||
hex = (normal + "%s" + reset) % (i, color)
|
||||
newline = '\n' if i % 6 == 3 else ''
|
||||
print index, hex, newline,
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue