It seems to be about 2-3x faster than using a SolidColor. Still much slower than doing conversions entirely in javascript, but is uses the application level ColorSettings for the conversions which is not possible otherwise. I have not been not able to find where ColorConversionModel is defined so I reverse engineered this enum:
const ColorConversionModel = Object.freeze({RGB: 3, HSB: 4, CMYK: 5, LAB: 6, GRAYSCALE: 7});
Also, what is up with some of these objects? The naming conventions are all over the place. “grain” in RGBColor? “yellowColor” in CMYKColorClass? hue: { _unit: “angleUnit”, _value: h } in HSBColorClass?
function rgbTo(r, g, b, model) {
return (core.convertColor({ _obj: "RGBColor", blue: b, grain: g, red: r }, model));
}
function labTo(l, a, b, model) {
return (core.convertColor({ _obj: "labColor", a: a, b: b, luminance: l,}, model));
}
function cmykTo(c, m, y, k, model) {
return (core.convertColor({ _obj: "CMYKColorClass", black: k, cyan: c, magenta: m, yellowColor: y }, model));
}
function hsbTo(h, s, b, model) {
return (core.convertColor({ _obj: "HSBColorClass", brightness: b, hue: { _unit: "angleUnit", _value: h }, saturation: s }, model));
}
function grayscaleTo(gray, model) {
return (core.convertColor({ _obj: "grayscale", gray: gray }, model));
}