As someone who is often at a loss when it comes to choosing the right colour palette for a visualisation, I have been told by a few people that Pokémon are actually a good place to start. Whether you use Tableau or other visualisation software, simply load up an image of your favourite Pokémon and use an eye-dropper tool to get your main colour palette. I have tried this principle and it seems to work. The above chart was made in Tableau using only colours from some of my favourite Pokémon. However, I found this process of eye-dropping each individual colour to be painstaking. In a perfect world, I would simply tell Tableau my favourite Pokemon and it would generate the colours for me. So, to the best of my ability, I have devised a solution to this problem.

Introducing the Pokémon Colour Palette Picker

Above is a screenshot of a simple app I developed in order to generate Pokémon colour palettes. If you enter the name of the Pokémon you wish to use and select the number of colours you want in your palette, the app will automatically generate a palette for you. As you can see, this palette is shown in a bar at the bottom of the app. Moreover, clicking “Copy to clipboard” will copy XML code that you can use to import those colours straight into Tableau – for more information on how to do this, check out this excellent blog.

Inside the Pokémon Colour Palette picker are a few simple algorithms. Underneath the GUI is python code that loads an image of your chosen Pokémon. Then, it converts that image into an array of RGB values – in other words, how red, green and blue each pixel is. With this pixel data, the app performs a k-means clustering algorithm. In simple terms, it finds clusters of colours, where the number of clusters is the user-inputted number of colours. By solving for the optimal means at these clusters, the app is able to generate key colours throughout the spectrum of image colours. This information is then outputted as the colour palette bar in the bottom of the app, and as XML for Tableau. To use the app for yourself, or to explore how it works, you can find it on my GitHub here. I hope it can help any Pokémon fans who, like myself, are often in need of creative colour palettes!

The Data School
Author: The Data School