import { Random } from "./random"; import { range } from "./util"; import * as colorspaces from 'colorspaces'; /** * Clamp the given number to be between 0 and 255, then * convert it to hexadecimal. */ export function clampedByteToHex(value: number): string { if (value < 0) { value = 0; } else if (value > 255) { value = 255; } let hex = value.toString(16); if (hex.length === 1) { hex = "0" + hex; } return hex; } function createRandomColor(rng: Random): string { const max_luv_samples = 100; let luv_sample_failed = true; let rand_color_hex:string = "#000000"; //See if we can pull out a sample inside the LUV solid for (let i=0; i(3)).map(() => rng.inRange({ min: 0, max: 255, step: 1 })); console.log(rgb) for(let i=0; i createRandomColor(rng)); }