/**
 * Internal dependencies
 */
import { toType } from "../../utils/dom";

export const getColorCSSValue = (color) => {
  return toType(color) === "object"
    ? color?.slug
      ? `var(--wp--preset--color--${color?.slug}, ${color?.value})`
      : color?.value
    : color;
};

export const isValidColor = (color) =>
  color &&
  (toType(color) === "string" || (toType(color) === "object" && color?.value));
