почему не выводит в консоль значение color?

код:
let hue, saturation, lightness;


const gradient = document.querySelector('.gradient');
gradient.style.height = '100px';
gradient.style.width = '90%';
gradient.style.background = 'linear-gradient(to right, hsla(0, 76%, 53%, 1), hsla(176, 76%, 53%, 1))';


function hexToHSL(hex) {

	const firstColor = document.createElement('div');
	firstColor.style.backgroundColor = hex;
	const color = window.getComputedStyle(firstColor).getPropertyValue('background-color');
	console.log(color);
}
let hex = '#66E22C';
const prettyGradient = document.querySelector('.pretty-gradient');
prettyGradient.style.height = '100px';
prettyGradient.style.width = '90%';
prettyGradient.style.background = 'linear-gradient(to right,' + hexToHSL(hex) + ', hsla(176, 76%, 53%, 1))';

