|
|
|
#!/usr/bin/env python3
|
|
|
|
default = "\033[0m"
|
|
|
|
bar = " "
|
|
|
|
def colors4():
|
|
|
|
seq_template = "\033[{};{}m{}"
|
|
|
|
text_template = seq_template + " The quick brown fox jumps over the lazy dog"
|
|
|
|
bold_template= "\033[{};{};1m{} The quick brown fox jumps over the lazy dog"
|
|
|
|
print("4 Bit colors (\\033[30;<color>m) Bold (\\033[30;<color>;1m)")
|
|
|
|
for color in range(30, 38):
|
|
|
|
print(seq_template.format(30, color+10, color+10) + bar + default + " " + text_template.format(30, color, color) + " " + bold_template.format(30, color, color) + default)
|
|
|
|
print
|
|
|
|
|
|
|
|
def colors8():
|
|
|
|
print("8 bit colors")
|
|
|
|
seq_template = "\033[{};{};{}m{}"
|
|
|
|
for color in range(16, 255):
|
|
|
|
if color < 100:
|
|
|
|
seq_template = "\033[{};{};{}m {} "
|
|
|
|
else:
|
|
|
|
seq_template = "\033[{};{};{}m {} "
|
|
|
|
# colorstring = "".join(seq_template.format(48, 5, i, i) for i in range(color, color + 36 ))
|
|
|
|
print(seq_template.format(48, 5, color, color), end='')
|
|
|
|
if color % 36 == 15:
|
|
|
|
print()
|
|
|
|
#print(seq_template.format(48, 5, color) + bar + default)
|
|
|
|
print()
|
|
|
|
def main():
|
|
|
|
colors4()
|
|
|
|
colors8()
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|