jquery / jquery-color

jQuery plugin for color manipulation and animation support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function to determine if a color parsed or used the default

opened this issue · comments

var fixedDefaultString = "#abcdef";
jQuery.Color.names["_default"] = fixedDefaultString;
var defaultColor = jQuery.Color("_default");
var parsedAsDefault = jQuery.Color("#abcdef");
var unparsed = jQuery.Color("I AM THE KING POTATO");

It would be nice to have a way to determine that unparsed is using the default, whereas parsedAsDefault is not. Ideally, it would be available after construction via something like .isParseable().

I'm unclear on what isParseable() should return in cases that do not involve parsing a string, however. For example:

jQuery.Color(100, 100, 100, 100).isParseable();
jQuery.Color().isParseable();

Yes, I'd also like a way to know whether the a given value (ANY value...not just a string) is parseable as well.

I'm unclear on what isParseable() should return in cases that do not involve parsing a string, however.

Not sure what you mean by this. It shouldn't matter whether it's a string or a number or an object...it's either parseable as a color or it isn't.