Created
October 1, 2019 08:03
-
-
Save gustavorv86/25b78efe34de4fd0a74c13eaab6589ac to your computer and use it in GitHub Desktop.
Print Bash palette color in python
This file contains hidden or 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/env python3 | |
def colors_16(): | |
print("\n\n8/16 COLORS\n") | |
buff = "" | |
for i in range(30, 38): | |
buff += "\t\033[{}m {}".format(i, i) | |
print(buff) | |
buff = "" | |
for i in range(90, 98): | |
buff += "\t\033[{}m {}".format(i, i) | |
print(buff) | |
print("\033[0m") | |
def colors_256(): | |
print("\n\n88/256 COLORS\n") | |
buff = "" | |
for i in range(0, 256): | |
buff += "\t\033[38;5;{}m {} ".format(i, i) | |
if (i+1) % 8 == 0: | |
buff += "\n" | |
print(buff) | |
print("\033[0m") | |
def main(): | |
colors_16() | |
colors_256() | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment