Node saturation now matches the basis colour saturation too
parent
eafc906210
commit
b22ac6546d
18
colours.js
18
colours.js
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue