import n from "../../Color.js";
import e from "../input.js";
import f from "../../utils/type.js";
import o from "../../colors/w3cx11.js";
import i from "../hex/hex2rgb.js";
import m from "../hex/rgb2hex.js";
n.prototype.name = function() {
  const r = m(this._rgb, "rgb");
  for (let t of Object.keys(o))
    if (o[t] === r) return t.toLowerCase();
  return r;
};
e.format.named = (r) => {
  if (r = r.toLowerCase(), o[r]) return i(o[r]);
  throw new Error("unknown color name: " + r);
};
e.autodetect.push({
  p: 5,
  test: (r, ...t) => {
    if (!t.length && f(r) === "string" && o[r.toLowerCase()])
      return "named";
  }
});
//# sourceMappingURL=index.js.map
