Skewcy's Blog


Hackers and Painters: Crafting an Academic Color Palette Inspired by Giorgio Morandi

I have created a color palette inspired by the subtle tones of Giorgio Morandi, designed specifically for academic research 🎨. This palette supports up to 18 distinct colors, and you can experiment with it here: link

Here’s a peek at how this palette enhances the visuals in my research paper 👀: in_paper -3quarterwidth in_paper -3quarterwidth

This project stands out for two key reasons: First, the colors are pre-sorted optimally, allowing you to easily select the top K colors for your needs. Second, we provide a color partition method tailored for those requiring multiple color groups.


Intro:

My journey to create this palette started with a simple inspiration: I love the painting style of Giorgio Morandi! His art, characterized by its simplicity and serene quietude, has always offered me comfort and calm 🖼️. More importantly, with my experiences as a PhD student, I know the importance of aesthetics in academic presentations. A well-designed paper can captivate readers from the first glance, and the color scheme plays a pivotal role in this engagement 🧑‍🎨.

paints -halfwidth

Initially, I searched the internet for existing Morandi-style color palettes and found many beautiful options that truly captured the essence of Morandi’s style, like the one shown here:

others -halfwidth

However, selecting the right colors for practical use proved challenging. For instance, if I needed to choose three colors to represent different data lines in a chart, deciding which three to pick from the plethora was no easy task đź’Ą.

Methods:

Feel free to skip the quote block of technical details if you are not nerd 🤓

Scenario #1:

Imagine we have a palette with $N$ colors but only need $K$ of them. The challenge is choosing the $K$ best colors.

Defining “Best”: We first need to define what is the “best”. In academic presentations, it’s crucial that colors are distinct and recognizable. We define “best” as the K colors that are the furthest apart, measured by the Euclidean distance between their RGB values 🔍.

rgb -3quarterwidth

Selection Process: Then we can start to find the colors with maximum difference. The approach is straightforward. We progressively add the best color at each step. Starting with a random color, we then choose subsequent colors that maximize the average distance from those already selected.

demo -3quarterwidth

Here’s what the final selection looks like:

order -3quarterwidth

Looks good, doesn’t it? 🎉

Finally, we demonstrate that the problem of selecting colors, in general, is intractable, meaning there is no efficient algorithm that can determine the best K colors in polynomial time 🧮.

In our scenario, where the RGB values $X,Y,Z$ are integers bounded within the range 0-255, there’s potential for a dynamic algorithm that achieves actually pseudo-polynomial complexity. While my current heuristic approach is sufficient for now, you can read this paper if you are interested 🫡:

Eremeev, A. V., Kel’manov, A. V., Kovalyov, M. Y., & Pyatkin, A. V. (2019). Maximum diversity problem with squared Euclidean distance. In Mathematical Optimization Theory and Operations Research: 18th International Conference, MOTOR 2019, Ekaterinburg, Russia, July 8-12, 2019, Proceedings 18 (pp. 541-551). Springer International Publishing.

Scenario #2:

A common challenge in academic presentations is visual differentiation among multiple groups of data. For instance, you might use dashed and solid lines to represent different categories in a graph, with each line in those categories distinguished by color.

Approach: To decide which colors belong in the same group, our goal is still to maximize the average Euclidean distance between the colors across all groups. This ensures that the colors within each group are distinct from those in others, enhancing clarity and visual appeal.

Method: We solve this problem using Integer Linear Programming (ILP), a mathematical approach that lets us formally define and solve such optimization problems. By using established ILP solvers, we can efficiently find the best grouping of colors.

Here’s what the outcome looks like (when 6 groups needed and each group contains 3 colors):

group -3quarterwidth

Following is how we solve it with ILP 🧩.

And it is not superising to see this problem is also NP-complete 🤖.

How to get the color set

While we’ve explored selecting the top $K$ colors from $N$ colors and how to group them effectively, an essential step remains: obtaining the initial set of $N$ colors. Here’s how I approached this 🖌️:

However, the colors extracted from paintings resulted in a palette that felt too dark for academic use, as shown here:

color -3quarterwidth

I got the above color palette from the following 22 Morandi’s paintings.

collage -halfwidth

Here the pseudo-algorithm that I used to extract colors:

Create an empty color list L
For each image in the folder: 
	Get the number of colors with pixel counts (C, K)
	If there exist color C' in L, that d(C', C) is too close:
	    continue to next color
	Else:
		Add color C into L 
Pick the top 18 most common colors and return

Feel free to choose any method that suits your project’s needs. Whether you opt for the ease of a predefined set or the tailored approach of extracting colors from artwork.

Conclusion:

I hope my exploration into creating a color palette has sparked some inspiration. For those of you working on articles, presentations, or academic papers, I highly recommend crafting a personalized color palette. There’s a unique satisfaction in seeing your chosen colors bring life to your work 💡.

Moreover, this method isn’t limited to Giorgio Morandi’s palette; it can be adapted to emulate the style of any artist that resonates with you. So, I encourage you to experiment and discover the aesthetic that best complements your narrative ✨.


skewcy@gmail.com