I'm trying to convert RGB to HEX and when i put numbers at the function the output is correct, but when i call the function in my code it doesn't work (just the **blue **color doesn't work).
my function:
const rgbToHex = (r, g, b) => {
console.log(
"#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1)
);
return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
};
i tried the change the function several time but it still doesn't work the all code https://codepen.io/doron-david/pen/WNdgEOd