code: function isValidColor(color) {
    if (!color || color.match(/px/g)) return false;
    if (color.match(/colorPalette|fade|shade|tint/g)) return true;
    if (color.charAt(0) === "#") {
      color = color.substring(1);
      return (
        [3, 4, 6, 8].indexOf(color.length) > -1 && !isNaN(parseInt(color, 16))
      );
    }
    return /^(rgb|hsl)a?\((\d+%?(deg|rad|grad|turn)?[,\s]+){2,3}[\s\/]*[\d\.]+%?\)$/i.test(
      color
    );
  }
docs: /*
  This function takes color string as input and return true if string is a valid color otherwise returns false.
  e.g.
  isValidColor('#ffffff'); //true
  isValidColor('#fff'); //true
  isValidColor('rgba(0, 0, 0, 0.5)'); //true
  isValidColor('20px'); //false