Created
December 9, 2019 17:55
-
-
Save idaWHALE/11659a86735a849fd879e32b0d88adee to your computer and use it in GitHub Desktop.
Take background and foreground colors and a step count. Generates color scale based on different foreground color transparency steps over the background.
Example: https://pasteboard.co/IKu4Sqw.png
This file contains 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
from Tkinter import * | |
def ablend(a, fg, bg): | |
return ((1-a)*fg[0]+a*bg[0], | |
(1-a)*fg[1]+a*bg[1], | |
(1-a)*fg[2]+a*bg[2]) | |
root = Tk() | |
num=8.0 | |
fg=(0, 188, 212) | |
bg=(18,21,25) | |
for i in range(int(num)+1): | |
col = ablend(i/num, fg, bg) | |
e = Label(root, text=" "*70, background='#%02x%02x%02x' % col) | |
print('#%02x%02x%02x' % col) | |
e.grid(row=i) | |
root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment