Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Problems with Color (non-numeric hex values) #2461

Closed
KorbinianMoser opened this Issue · 6 comments

3 participants

@KorbinianMoser

var test = new Color('#ccc');
console.log( test);

and all other hex values without numbers result in

[NaN,NaN,NaN]

I'm using current versions of core and more, the bug suddenly appeared in old (previously working) code. What's wrong?

@KorbinianMoser

I can't believe that I am the only one with that problem... seems like very basic mistake in the color translation to me.

@arian
Owner

Both new Color('#ccc') and #ccc'.hexToRgb() work fine for me. Which MooTools version are you using?

@KorbinianMoser

Hi Arian, thanks for your reply! It's https://ajax.googleapis.com/ajax/libs/mootools/1.4/mootools.js.
console.log( new Color('#ccc')); still outputs [NaN,NaN,NaN].
Maybe Google needs an update to the current version? Or doesn't my link get the current version from there?

@arian
Owner

Should work: http://jsfiddle.net/vzF7q/

Google has the same MooTools Core version. Color however is in MooTools More. If you use More 1.4 it should just work.

@KorbinianMoser

Oh! Seems like one of my scripts crashed it!
Thanks for your help!

By the way: in Mootools.More Class.Refactor there should be a {} behind for (offset = 0; offset < baseDir.length && offset < relDir.length && baseDir[offset] == relDir[offset]; offset++), Google Closure Compiler always complains that.

@KorbinianMoser

Got it. I messed around with String.toInt, that caused the problem.

@ibolmo ibolmo closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.