master
Felix Pankratz 4 years ago
parent 7fd85c6b8e
commit c8fbdf25ca

@ -5,10 +5,10 @@ def colors4():
seq_template = "\033[{};{}m{}" seq_template = "\033[{};{}m{}"
text_template = seq_template + " The quick brown fox jumps over the lazy dog" 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" 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)") print("4 bit colors (\\033[30;<color>m) Bold (\\033[30;<color>;1m)")
for color in range(30, 38): 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(seq_template.format(30, color+10, color+10) + bar + default + " " + text_template.format(30, color, color) + " " + bold_template.format(30, color, color) + default)
print print()
def colors8(): def colors8():
print("8 bit colors (\\033[48;5;<color>m{})") print("8 bit colors (\\033[48;5;<color>m{})")
@ -21,10 +21,20 @@ def colors8():
print(seq_template.format(48, 5, color, color), end='') print(seq_template.format(48, 5, color, color), end='')
if color % 36 == 15: if color % 36 == 15:
print() print()
print(default)
def colorsRGB():
print('RGB color test')
# oh boy, here we go.
fg_template = "\033[38;2;{};{};{}m"
bg_template = "\033[48;2;{};{};{}m"
for i in range(256):
print(bg_template.format(i, 0, 0) + " ", end='')
print() print()
def main(): def main():
colors4() colors4()
colors8() colors8()
colorsRGB()
if __name__ == "__main__": if __name__ == "__main__":
main() main()

Loading…
Cancel
Save