I\'ve written a jQuery plugin that accepts css colors for some of its parameters.
I want to validate them. If it was just a hex or rgb value I could do that with a r
Inspired by Valen's answer:
v=c=>((s=document.head.style).color=c,q=s.color,s.color='',!!q);
// v('red') => true
// v('reeeed') => false
More readably:
const validColor = c => {
document.head.style.color = c;
const q = document.head.style.color;
document.head.style.color = '';
return !!q
};