import { floatRegex } from "./dist-es-value-types-utils-float-regex.js";
import { isNullish } from "./dist-es-value-types-utils-is-nullish.js";
import { singleColorRegex } from "./dist-es-value-types-utils-single-color-regex.js";
const isColorString = (type, testProp) => (v) => {
  return Boolean(typeof v === "string" && singleColorRegex.test(v) && v.startsWith(type) || testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
};
const splitColor = (aName, bName, cName) => (v) => {
  if (typeof v !== "string")
    return v;
  const [a, b, c, alpha] = v.match(floatRegex);
  return {
    [aName]: parseFloat(a),
    [bName]: parseFloat(b),
    [cName]: parseFloat(c),
    alpha: alpha !== void 0 ? parseFloat(alpha) : 1
  };
};
export {
  isColorString,
  splitColor
};
//# sourceMappingURL=dist-es-value-types-color-utils.js.map
