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) => { export const get_colours = (basis) => {
const basis_c = Color(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; const scheme = new ColorScheme;
scheme.from_hue(hsl['color'][0]).scheme("tetrade").variation("hard").distance(0.5); scheme.from_hue(hue).scheme("tetrade").distance(0.75);
const colours = scheme.colors().map((cs) => parseInt('0x' + cs)); const colours = scheme.colors().slice(1, 9);
const set = colours.slice(1, 9); colours.reverse();
set.reverse(); const hsl = colours.map((c) => Color("#" + c).hsl());
set.unshift(basis); const resaturated = hsl.map((hslc) => hslc.saturationl(saturation).rgbNumber());
return set; resaturated.unshift(basis);
return resaturated;
} }
// basic colours where 0 = blue // basic colours where 0 = blue