docs/js/init.js
function rgb2hex(rgb) {
      if (/^#[0-9A-F]{6}$/i.test(rgb)) {
        return rgb;
      }

      rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);

      if (rgb === null) {
        return 'N/A';
      }

      function hex(x) {
        return ('0' + parseInt(x).toString(16)).slice(-2);
      }

      return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
    }
function rgb2hex(rgb) {
      if (/^#[0-9A-F]{6}$/i.test(rgb)) {
        return rgb;
      }

      rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);

      if (rgb === null) {
        return 'N/A';
      }

      function hex(x) {
        return ('0' + parseInt(x).toString(16)).slice(-2);
      }

      return '#' + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]);
    }
function rgb2hex ( rgb ) { if ( / ^#[0-9A-F]{6}$ / i . test ( rgb ) ) { return rgb ; } rgb = rgb . match ( / ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ / ) ; if ( rgb === null ) { return 'N/A' ; } function hex ( x ) { return ( '0' + parseInt ( x ) . toString ( 16 ) ) . slice ( - 2 ) ; } return '#' + hex ( rgb [ 1 ] ) + hex ( rgb [ 2 ] ) + hex ( rgb [ 3 ] ) ; }
convert rgb to hex value string
convert rgb to hex value string