Spoiler: It’s harder than you think.
Colors are hard, especially if you don’t have an eye for design.
Most of us tech professionals don’t. The upside is that Python can do most of the heavy lifting for you. It can generate an entire monochromatic color palette that’ll look stunning on any stacked chart.
The downside is that getting there requires a fair bit of coding. You have to write custom functions to convert a color from HEX to HSL and vice versa, and figure out if the starting color is too bright, as well as how much lighter each next color should be.
Adding insult to injury, I haven’t found a single fully working Python library capable of accomplishing this task.
That’s where this article chimes in.
If you’re a subscriber to my Substack, you can skip the reading and download the notebook instead.
Let’s quickly cover three color formats you need to know:
- HEX — A six-digit code typically used in web development and graphic design. The color code starts with a
#
, followed by six hexadecimal digits. Pairs…