🎨 A tool program to set terminal colors from image
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
Vg3ve2E.jpg
pigment.py
scrot1.png
scrot2.png

README.md

Pigment

This is simple tool which uses the K-means++ algorithm to pick suitable terminal colors from a given image. The algorithm is an approximation for solving clustering/paritioning problems, which in this particular case means finding N = 8 dominant colors in the image. Obviously, it does not work well on pictures with narrow spectrum.

To set colors in Pantheon terminal (Elementary OS), simply invoke the following

./pigment.py [image filename]

Currently, the code only works in Pantheon terminal, but the colors can be extracted and manually inserted into your favorite terminal's settings. Running the script for the image below...

we get the following set of colors:

Another example is as follows:

To tweak the colors, you can set beta and gamma to increase general brightness and decrease background brightness, respectively.