The way to Convert a Single HEX Color Code right into a Monochrome Color Palette with Python

-

Spoiler: It’s harder than you think that.

Article thumbnail (image by writer)

Colours are hard, especially in the event you don’t have a watch for design.

Most of us tech professionals don’t. The upside is that Python can do a lot of the heavy lifting for you. It could generate a whole monochromatic color palette that’ll look stunning on any stacked chart.

The downside is that getting there requires a good little bit of coding. You’ve to jot down custom functions to convert a color from HEX to HSL and vice versa, and work out if the starting color is just too vibrant, in addition to how much lighter each next color must be.

Adding insult to injury, I haven’t found a single fully working Python library able to accomplishing this task.

That’s where this text chimes in.

If you happen to’re a subscriber to my Substack, you possibly can skip the reading and download the notebook as an alternative.

Let’s quickly cover three color formats you should know:

  • HEX — A six-digit code typically utilized in web development and graphic design. The colour code starts with a #, followed by six hexadecimal digits. Pairs…
ASK ANA

What are your thoughts on this topic?
Let us know in the comments below.

0 0 votes
Article Rating
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

0
Would love your thoughts, please comment.x
()
x