Resolved issue of previous selection of color #111

This commit is contained in:
Amrit Rai 2023-02-09 18:39:27 +05:30
parent ee8c776103
commit 9b12c64c2c
1 changed files with 5 additions and 3 deletions

View File

@ -160,11 +160,13 @@ const ColorModule = (() => {
//generate random color
const newColor = new Color("hsv", Math.floor(Math.random()*360), Math.floor(Math.random()*100), Math.floor(Math.random()*100)).hex;
//remove current color selection
document.querySelector('#colors-menu li.selected')?.classList.remove('selected');
//add new color and make it selected
let addedColor = addColor(newColor);
addedColor.classList.add('selected');
//remove previous color selection
document.querySelector('#colors-menu li.selected')?.classList.remove('selected');
addedColor.classList.add('selected');
addedColor.style.width = squareSize + "px";
addedColor.style.height = squareSize + "px";