import matplotlib.colorsimport colorsysimport numpy as npdef add_lightness(color_name, L):""" Receives a color name ("red", "tab:blue", "xkcd:green", etc), Returns RGB values of same color with lightness L added to it (can be negative too) """ color_hls = colorsys.rgb_to_hls(*matplotlib.colors.to_rgb(color_name)) new_color_hls = np.array(color_hls) new_color_hls[1] = new_color_hls[1] + Lif new_color_hls[1] >1.0: new_color_hls[1] =1.0if new_color_hls[1] <0.0: new_color_hls[1] =0.0 new_shade_rgb = colorsys.hls_to_rgb(*new_color_hls)return new_shade_rgbadd_lightness("gold", 0.1)
xkcd colors that I like
Don’t use them all together. Use black, some shade of gray, and one or two of the colors below. That’s more than enough. Source: xkcd color survey