Get A Color Name From Any Rgb Combination (script Included)
i am returning a hex and an RGB color in my app (from camara) and i want to use a script to identify that color and display a name... ive found http://gauth.fr/2011/09/get-a-color
Solution 1:
Hard to give you a definitive answer as there's not enough detail - but if you're calling the two external resources correctly (you'll also need jQuery if you're using this method), then you should get an alert as requested. Here's a fiddle of it working correctly when you bring the resources inline (which excludes the need for jQuery) https://jsfiddle.net/j3gbwvvg/. The reason you don't need jQuery is because we're putting the data directly into a variable and calling that, not using the library's function which utilises the .getJSON() jQuery function.
window.classifier = new ColorClassifier();
window.classifier.learn(data);
var result_name = window.classifier.classify("#aaf000");
alert(result_name);
Post a Comment for "Get A Color Name From Any Rgb Combination (script Included)"