fourdjs/colours.js
Mike Lynch c093c89ce6 Indexing algorithm tested on the 50-cell skeleton of great circles
without any deadlocks or label mismatches
2023-08-28 08:31:45 +10:00

20 lines
450 B
JavaScript

import ColorScheme from 'color-scheme';
export const get_colours = (basis) => {
const scheme = new ColorScheme;
const hexbasis = basis.toString(16).padStart(6, "0");
scheme.from_hex(hexbasis).scheme("tetrade").variation("hard").distance(0.5);
return scheme.colors().map((cs) => parseInt('0x' + cs));
}
export const get_plain_colours = (basis) => {
return [
basis,
0xffffff,
0x00ff00,
0xff0000,
0x0000ff,
0xff9900,
0x000000,
]
}