jquery-color icon indicating copy to clipboard operation
jquery-color copied to clipboard

Function to determine if a color parsed or used the default

Open ghost opened this issue 11 years ago • 1 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();

ghost avatar Nov 01 '13 22:11 ghost

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.

zakdances avatar Oct 25 '14 18:10 zakdances