multicolors-converter
Version:
A very simple tool to convert colors into differents formats
40 lines (39 loc) • 980 B
JavaScript
import { Converter } from "@src/converters/Converter";
export class RalConverter extends Converter {
/**
*
* @param ral The RAL color to convert to Rgb
*/
static ralToRgb(ral) {
let found = null;
this.getColors().find((c) => {
if (c.ral === ral.toUpperCase())
found = c.rgb.split("-").map(Number);
});
return found;
}
/**
*
* @param ral The RAL color to convert to Name
*/
static ralToName(ral) {
let found = null;
this.getColors().find((c) => {
if (c.ral === ral.toUpperCase())
found = c.name;
});
return found;
}
/**
*
* @param ral The RAL color to convert to HexaDecimal
*/
static ralToHex(ral) {
let found = null;
this.getColors().find((c) => {
if (c.ral === ral.toUpperCase())
found = c.hex;
});
return found;
}
}