From c6fa64c98039567a307981dd2f4e47284c6ac6eb Mon Sep 17 00:00:00 2001 From: lolabird Date: Mon, 13 Nov 2023 03:17:57 -0700 Subject: [PATCH] Fix active color sticking to color picker when inactive --- script.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/script.js b/script.js index b7ea3a7..8847201 100644 --- a/script.js +++ b/script.js @@ -180,6 +180,7 @@ function pickBackground() { } } + function convertHexToRGB(val) { hex = val.replace(/^#/, ''); @@ -214,6 +215,7 @@ function adjustTransparency() { rangeSlider.style.setProperty('--canvas-color', `rgba(${r},${g},${b},${a})`); } + function colorGrid() { if (isRgb) { this.style.backgroundColor = randomizeColor(); @@ -239,6 +241,8 @@ function colorGrid() { function changeColor() { const buttonID = this.id; + + colorPicker.classList.remove ("is-active"); buttons.forEach(btn => btn.classList.remove("is-active")); this.classList.add("is-active");