import { reverse3 } from '../../utils/index.mjs';
import chroma from '../../chroma.mjs';
import Color from '../../Color.mjs';
import input from '../input.mjs';
import lch2rgb from './lch2rgb.mjs';
import hcl2rgb from './hcl2rgb.mjs';
import rgb2lch from './rgb2lch.mjs';
import unpack from '../../utils/unpack.mjs';
import type from '../../utils/type.mjs';

Color.prototype.lch = function () {
    return rgb2lch(this._rgb);
};
Color.prototype.hcl = function () {
    return reverse3(rgb2lch(this._rgb));
};

const lch$1 = (...args) => new Color(...args, 'lch');
const hcl = (...args) => new Color(...args, 'hcl');

Object.assign(chroma, { lch: lch$1, hcl });

input.format.lch = lch2rgb;
input.format.hcl = hcl2rgb;
['lch', 'hcl'].forEach((m) =>
    input.autodetect.push({
        p: 2,
        test: (...args) => {
            args = unpack(args, m);
            if (type(args) === 'array' && args.length === 3) {
                return m;
            }
        }
    })
);

export { hcl, lch$1 as lch };
//# sourceMappingURL=index.mjs.map
