Skip to content

Instantly share code, notes, and snippets.

@geogradient
Created April 30, 2015 06:09
Show Gist options
  • Save geogradient/c226eb0c98f45a0d5310 to your computer and use it in GitHub Desktop.
Save geogradient/c226eb0c98f45a0d5310 to your computer and use it in GitHub Desktop.
# Function to make an automatic colour list holding Hex values.
import colorsys
def get_N_HexCol(N=5):
HSV_tuples = [(x*1.0/N, 1, 1) for x in xrange(N)]
hex_out = []
for rgb in HSV_tuples:
rgb = map(lambda x: int(x*255),colorsys.hsv_to_rgb(*rgb))
hex_out.append("".join(map(lambda x: chr(x).encode('hex'),rgb)))
return ["#"+c_value for c_value in hex_out]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment