code: function toHex(c) {
      var m = c.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/)
      return (m ? rgb(m[1], m[2], m[3]) : c)
        .replace(/#(\w)(\w)(\w)$/, '#$1$1$2$2$3$3') // short skirt to long jacket
    }
docs: convert rgb and short hex to long hex