Skip to content

GitHub Languages Colour Palettes

Have you ever wanted a full list of colours used for the various programming languages on GitHub? No? Well if you ever do, I've put together a collection of various palette formats containing them all, along with a Python script which builds them.

What's this all about?

You almost certainly already know that GitHub uses colours in various places across the site to indicate what languages appear in repositories.

Screenshot showing repositories on GitHub
Main language and colour shown by each repository
Screenshot of a language bar for a repository on GitHub
Language breakdown bar for a repository

The other day I was looking for a way to grab a list of all the colours and the corresponding language so that I might potentially use it myself. A short amount of searching later, I found that Dominik Dario had put together a JSON file containing all the languages and colours, along with a little Python script which built the file. However what I really wanted was a palette file which I could open up in Colour Chooser.

Straight from the source

Initially I was going to write a script which took Dominik's JSON file and wrote out a Colour Chooser palette based on that. However I figured that if I was going to do that, I may as well take the list directly from the source, which is within the GitHub Linguist repository. There, there's a big YAML file which contains all the languages which Linguist — and by extension, GitHub itself — recognises, and that also contains the colours. Reading a YAML file for a JSON file isn't really that different as both are solved problems, and that way I don't have an intermediate source which could potentially get out of date.

Palette Formats

Instead of writing a script which output just a Colour Chooser palette file — which, although useful to me, might not be useful to everyone — I instead put together one which can output in a number of formats. When I built Colour Chooser, I gave that the ability to read and write a whole bunch of formats, so I already had experience working with the Adobe palette formats and others, so replicated some of that behaviour in Python.

In the end, I have something which can output the colours in these formats:

  • Colour Chooser palette (.ccxml)
  • GIMP palette (.gpl)
  • Adobe Swatch Exchange file (.ace)
  • Adobe Photoshop Color Swatch file (.aco)
  • JSON
  • CSV

The final two were just little extras really. I added JSON just for completeness, although obviously I'm not the first here, and CSV on the off-chance that it might come in useful at some point.

Usage

If you'd like to use one of the palette files yourself, just grab them from the palettes folder in the GitHub repository. Assuming you're just after the palette, that's all you'll need to do.

If you're interested in running the Python script yourself or having a look at the code, check it out on GitHub. The readme file there will give all the details of the requirements and how to run it to generate the files on your own machine.

Hopefully whatever tool you might be working with will be able to handle one of these formats, or the JSON/CSV files would work as a starting point. However if you'd like a different palette format, feel free to either open an issue on that repository and I will see what I can do when I have time, or I'd be happy to accept a pull request adding the functionality. The only thing to mention here though is I have purposefully missed out some palette formats which do not include names for the colours (e.g. the Paint.NET .txt format). I thought that would end up missing the point a bit.