Created
January 20, 2021 04:20
-
-
Save nick3499/38acde500109010ecf95495272d08980 to your computer and use it in GitHub Desktop.
Python: Generate 256-Color Gradient Chart
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 python | |
'''Generate gradient chart.''' | |
N = 16 | |
def gen_gradient(): | |
'''Generate gradient.''' | |
global N | |
f_str = f'' | |
for i in range(0, 6): | |
f_str += f'\x1b[48;5;{N}m {N} ' | |
N += 1 | |
f_str += '\x1b[0m' | |
return f_str | |
def generate_chart(): | |
'''Generate gradient chart.''' | |
global N | |
for i in range(0, 36): | |
print(gen_gradient()) | |
if __name__ == '__main__': | |
generate_chart() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment