Answers for "how to check if a color is valid in javascript"

0

how to check if a color is valid in javascript

function isValidColor(strColor) {
  var s = new Option().style;
  s.color = strColor;

  // return 'false' if color wasn't assigned
  return s.color == strColor.toLowerCase();
}
Posted by: Guest on March-11-2021

Code answers related to "how to check if a color is valid in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language