Created
April 1, 2019 18:24
-
-
Save kpmiller/dcf2b6e64e13f12734d117516f797730 to your computer and use it in GitHub Desktop.
python colorsys
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
#!/usr/bin/python | |
import colorsys | |
def PrintHex(v): | |
vv0 = v[0] * 255.0 | |
vv1 = v[1] * 255.0 | |
vv2 = v[2] * 255.0 | |
print ( "#%02X%02X%02X" % (vv0, vv1, vv2)) | |
r = 0.8 | |
g = 0.2 | |
b = 0.3 | |
i = 1.0 | |
hsv = colorsys.rgb_to_hsv(r, g, b) | |
h = hsv[0] | |
s = hsv[1] | |
count = 88.0 | |
i = 0.0; | |
while i < (count+1.0): | |
# v = i / count | |
v = (count-i) / count; #reverse shades from light to dark | |
rgb = colorsys.hsv_to_rgb(h, s, v) | |
print ("%0.5ff, %0.5ff, %0.5ff, 1.00000f," % rgb) | |
# PrintHex(rgb) #html color | |
i = i + 1.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment