import m from "../../chroma.js";
import e from "../../Color.js";
import n from "../input.js";
import o from "../../utils/type.js";
import i from "../../utils/unpack.js";
const { round: p } = Math;
e.prototype.rgb = function(r = !0) {
  return r === !1 ? this._rgb.slice(0, 3) : this._rgb.slice(0, 3).map(p);
};
e.prototype.rgba = function(r = !0) {
  return this._rgb.slice(0, 4).map((t, u) => u < 3 ? r === !1 ? t : p(t) : t);
};
const b = (...r) => new e(...r, "rgb");
Object.assign(m, { rgb: b });
n.format.rgb = (...r) => {
  const t = i(r, "rgba");
  return t[3] === void 0 && (t[3] = 1), t;
};
n.autodetect.push({
  p: 3,
  test: (...r) => {
    if (r = i(r, "rgba"), o(r) === "array" && (r.length === 3 || r.length === 4 && o(r[3]) == "number" && r[3] >= 0 && r[3] <= 1))
      return "rgb";
  }
});
export {
  b as rgb
};
//# sourceMappingURL=index.js.map
