Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to determine if a color parsed or used the default #61

Open
ghost opened this issue Nov 1, 2013 · 1 comment
Open

Function to determine if a color parsed or used the default #61

ghost opened this issue Nov 1, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 1, 2013

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();
@zakdances
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant