I made a card which gives its color to the background with color thief. My problem is that when I display the map over the first one and remove my mouse then I come back. Color animation no longer does this. thanks for the help
// Using the script Color Thief
(function() {
var colorThief = new ColorThief();
// At the mouse over we put the color of the image
const displayBgFromAverage = (img) => {
img.addEventListener("mouseover", () => {
var rgb = colorThief.getColor(img);
document.body.style.backgroundColor = 'rgb(' + rgb.join(', ') + ')', "50s","ease";
});
};
document.querySelectorAll('.img').forEach(displayBgFromAverage);
// At mouse leave we put the base color
const stopBgFromAverage = (img) => {
img.addEventListener("mouseleave", () => {
document.body.style.transition = " ease-out 1500ms";
document.body.style.backgroundColor = '#252525';
});
};
document.querySelectorAll('.card').forEach(stopBgFromAverage);
}());