Potion Color — palettes that look good with varying data sizes
A new module was just released in the Potion library for generating color palettes for data visualization that automatically look good with any number of nodes.
It is difficult to find good examples of large color palettes or even good advice as to how to go about creating your own color palettes online. The vast majority of palettes have a maximum of 5 colors and when creating bigger palettes the general consensus is that you should pay attention to several factors and use your best judgement — good luck.
A common result is that when creating a large palette you tend to just pick a random set of colors and hope that they look well together when displayed together in the visualization. For some people this is an easier task than others. I, for one, struggle to match colors well together and so I wondered whether there was an easier, more automatic way to tackle the problem.
While researching this issue I came across an example of a color palette that was derived from a gradient between two colors — one light and one dark.
The end result was an array of colors that were all varied to each other and that looked good when put together on the screen. They also worked well to display information to color blind viewers.
This gave me a great idea — a bit of code which can generate color palettes for you with varying numbers of colors, created using the same approach as the images above.
And so I introduce Potion Color a module that does just that. Some methods for defining palettes are:
- from D3 presets from the d3-scale-chromatic library;
- using custom color ranges of two or more colors;
- or even creating palettes that have been generated randomly and maintain a good luminosity range.
Enjoy and leave suggestions and requests, issues at the Github page.