Node saturation now matches the basis colour saturation too

feature-node-foreshortening
Mike Lynch 2024-04-07 12:38:06 +10:00
parent eafc906210
commit b22ac6546d
1 changed files with 11 additions and 7 deletions

View File

@ -3,14 +3,18 @@ import Color from 'color';
export const get_colours = (basis) => {
const basis_c = Color(basis);
const hsl = basis_c.hsl();
const hslb = basis_c.hsl();
const hue = hslb['color'][0];
const saturation = hslb['color'][1];
const luminance = hslb['color'][2];
const scheme = new ColorScheme;
scheme.from_hue(hsl['color'][0]).scheme("tetrade").variation("hard").distance(0.5);
const colours = scheme.colors().map((cs) => parseInt('0x' + cs));
const set = colours.slice(1, 9);
set.reverse();
set.unshift(basis);
return set;
scheme.from_hue(hue).scheme("tetrade").distance(0.75);
const colours = scheme.colors().slice(1, 9);
colours.reverse();
const hsl = colours.map((c) => Color("#" + c).hsl());
const resaturated = hsl.map((hslc) => hslc.saturationl(saturation).rgbNumber());
resaturated.unshift(basis);
return resaturated;
}
// basic colours where 0 = blue