Global.renderColorAsString (c)
function tries to check if the color contains just hex-characters if so, it returns the color-definition prefixed with a '#' otherwise it assumes the color is a named one

Sourcecode in Global/renderFunctions.js:
1:   function renderColorAsString(c) {
2:      if (c && c.isHexColor())
3:         return "#" + c;
4:      return c;
5:   }