logoGenerator.js
/**
 * Helper function to convert a hexadecimal color to RGBA format.
 * @link https://stackoverflow.com/a/28056903/6456163
 * @param {String} hex
 * @param {Number} opacity
 * @returns {String}
 */
Helper function to convert a hexadecimal color to RGBA format.
Helper function to convert a hexadecimal color to RGBA format .
function hexToRGB(hex, alpha) {
	const r = parseInt(hex.slice(1, 3), 16),
	      g = parseInt(hex.slice(3, 5), 16),
	      b = parseInt(hex.slice(5, 7), 16);
	return alpha
		? `rgba(${r}, ${g}, ${b}, ${alpha})`
		: `rgb(${r}, ${g}, ${b})`;
}
function hexToRGB ( hex , alpha ) { const r = parseInt ( hex . slice ( 1 , 3 ) , 16 ) , g = parseInt ( hex . slice ( 3 , 5 ) , 16 ) , b = parseInt ( hex . slice ( 5 , 7 ) , 16 ) ; return alpha ? ` ${ r } ${ g } ${ b } ${ alpha } ` : ` ${ r } ${ g } ${ b } ` ; }
Helper function to convert a hexadecimal color to RGBA format.
Helper function to convert a hexadecimal color to RGBA format .