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

Closed
KorbinianMoser opened this Issue Jan 10, 2013 · 6 comments

Comments

Projects
None yet
3 participants

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?

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

Owner

arian commented Feb 17, 2013

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

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?

Owner

arian commented Feb 17, 2013

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.

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.

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

ibolmo closed this Mar 3, 2014

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