Skip to content

Instantly share code, notes, and snippets.

@jtoomim
Created December 5, 2015 07:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtoomim/60e762a178642fb371a2 to your computer and use it in GitHub Desktop.
Save jtoomim/60e762a178642fb371a2 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
all_colors = ['#aec7e8',
'#ff7f0e',
'#1f77b4',
'#ffbb78',
'#2ca02c',
'#98df8a',
'#d62728',
'#ff9896',
'#9467bd',
'#c5b0d5',
'#8c564b',
'#c49c94',
'#e377c2',
'#f7b6d2',
'#7f7f7f',
'#c7c7c7',
'#bcbd22',
'#dbdb8d',
'#17becf',
'#9edae5',
]
rgbs = []
for color in all_colors:
r, g, b = map(lambda x: (int(x, 16)), map(lambda x: '0x'+x, (color[1:3], color[3:5], color[5:7])))
rgbs.append([r, g, b])
def clampaddf(i):
def clampadd(col):
return min(max(col + i, 0), 255)
return clampadd
classes = [[map(clampaddf(i), color) for i in range(-20, 21, 10)] for color in rgbs]
strclasses = [['#' + ''.join([hex(col)[2:4] for col in color]) for color in cl] for cl in classes]
print strclasses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment