Made n2c a global function for js in partial.

Moved helper function to convert string -> color name into a partial to
be included onto layouts where it needs to be. Updated function
algorithm as well. Trying to figure out the best way to avoid collisions
is a pretty fun thing to play with.