class RGB {
constructor(r, g, b) {
this.r = r;
this.g = g;
this.b = b;
}
static fromHSV(h, s, v) {
const {r, g, b} = HSVtoRGB(h, s, v);
return new RGB(r, g, b);
}
static fromHS1(h, s) {
const {r, g, b} = HS1toRGB(h, s);
return new RGB(r, g, b);
}
static fromGrayscale(val) {
return new RGB(val, val, val);
}
static interpolate(a, b, n) {
const m = 1 - n;
return new RGB(
Math.round(a.r * n + b.r * m),
Math.round(a.g * n + b.g * m),
Math.round(a.b * n + b.b * m),
);
}
toHex() {
return RGBtoHEX(this.r, this.g, this.b);
}
static fromArray(arr) {
return new RGB(arr[0], arr[1], arr[2]);
}
static get Black() { return new RGB(0, 0, 0); }
static get White() { return new RGB(255, 255, 255); }
static get Red() { return new RGB(255, 0, 0); }
static get Green() { return new RGB(0, 255, 0); }
static get Blue() { return new RGB(0, 0, 255); }
static get Yellow() { return new RGB(255, 255, 0); }
static get Cyan() { return new RGB(0, 255, 255); }
static get Magenta () { return new RGB(255, 0, 255); }
}