Open DanJFletcher opened 8 years ago
Here's isValidColor in the repo, for context: https://github.com/Khan/live-editor/blob/master/js/output/webpage/webpage-tester.js To avoid having to write out every name in javascript, I did make it pass for a lot of things that aren't valid colors.
We could just bring the array of colors in like your code does or we could have it fail for the known bad cases like rg() - strings that that look like attempts at rgb().
It might also be okay to just have it implemented fully in that challenge. The early challenges are where the majority of newbie color errors will happen, most likely.
Thanks for filing!
Ok, so would you say it makes sense to leave it as is, until this becomes a higher priority issue then?
When using the isValidColor method in the HTML validation code, values such as "rg(255,0,0)" will return true, causing a pass in the grader.
My temporary solution in the coding challenge, Colorful Creature:
And then it can be used like this:
Maybe the isValidColor method wasn't intended to be used from the validation code, but it's useful when it works properly :) Is this something worth adding, or is there another way to validate colors that's already implemented?
Thanks in advance for any thoughts.