3 ms·
For use cases where one truly needs to put aesthetics and accessibility aside, and instead squeeze the gamut of possible colours to the max (eg, because one has
by tripu 6y ago
For use cases where one truly needs to put aesthetics and accessibility aside, and instead squeeze the gamut of possible colours to the max (eg, because one has to assign distinctive colours to dozens or hundreds of elements), I have a JS library which includes a method for that:
// We have a viz with 50 items; let's assign colours to those items:
import { palette } from 'supers';
const colours = new palette(50);
for (let i = 0; i < 50; i ++)
chart[i].css('color', '#' + colours.get(i, true));
Online demo: https://codepen.io/tripu/full/JEMBoN https://codepen.io/tripu/full/JEMBoN
Documentation: https://github.com/tripu/superscript/blob/master/.github/README.md#Palette https://github.com/tripu/superscript/blob/master/.github/REA...