function hexRgb(hex){
    let shorthandCheck = /^([a-f\d])([a-f\d])([a-f\d])$/i,
        rgbRegex = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,
        rgb;

    hex = hex.replace(shorthandCheck, function(m, r, g, b) {
      return r + r + g + g + b + b;
    });

    rgb = hex.replace(/^\s+|\s+$/g, '').match(rgbRegex);

    // Convert it
    return rgb ? [
      parseInt(rgb[1], 16),
      parseInt(rgb[2], 16),
      parseInt(rgb[3], 16)
    ] : false;
  }
function hexRgb(hex){
    let shorthandCheck = /^([a-f\d])([a-f\d])([a-f\d])$/i,
        rgbRegex = /^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,
        rgb;

    hex = hex.replace(shorthandCheck, function(m, r, g, b) {
      return r + r + g + g + b + b;
    });

    rgb = hex.replace(/^\s+|\s+$/g, '').match(rgbRegex);

    // Convert it
    return rgb ? [
      parseInt(rgb[1], 16),
      parseInt(rgb[2], 16),
      parseInt(rgb[3], 16)
    ] : false;
  }
function hexRgb ( hex ) { let shorthandCheck = / ^([a-f\d])([a-f\d])([a-f\d])$ / i , rgbRegex = / ^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$ / i , rgb ; hex = hex . replace ( shorthandCheck , function ( m , r , g , b ) { return r + r + g + g + b + b ; } ) ; rgb = hex . replace ( / ^\s+|\s+$ / g , '' ) . match ( rgbRegex ) ; // Convert it return rgb ? [ parseInt ( rgb [ 1 ] , 16 ) , parseInt ( rgb [ 2 ] , 16 ) , parseInt ( rgb [ 3 ] , 16 ) ] : false ; }
Hex to RGB converter
@param  {string} hex hexidecimal string without #
@return {array} RGB values
Hex to RGB converter