I have an application in which a user can enter a color name, say blue, as soon as he does, the div will turn into that color.
Currently the code is pretty simple:
<div class="colorBox" style="background-color: <%= color.name %>;">
</div>
Is it possible to check if this particular color exists? At the moment, I can only think of one solution:
Scroll through the list of color names, like this one , but is there a more elegant way? for instance
CSS.exists("blue")
=> true
Also, I do not want the user to enter hexadecimal color.
source
share