import chroma from '../../chroma.mjs';
import Color from '../../Color.mjs';
import input from '../input.mjs';
import type from '../../utils/type.mjs';
import rgb2css from './rgb2css.mjs';
import css2rgb from './css2rgb.mjs';

Color.prototype.css = function (mode) {
    return rgb2css(this._rgb, mode);
};

const css = (...args) => new Color(...args, 'css');
chroma.css = css;

input.format.css = css2rgb;

input.autodetect.push({
    p: 5,
    test: (h, ...rest) => {
        if (!rest.length && type(h) === 'string' && css2rgb.test(h)) {
            return 'css';
        }
    }
});

export { css };
//# sourceMappingURL=index.mjs.map
