Fixed toColor function returning NaN

I've tested the 'toColor' function with the rgba hex 'FFFFFF00'.
The returned result (in r,g,b,a) was 1,NaN,1,257.
The correct result should obviously be 1,1,1,0.
The hex substring was being done incorrectly.