Fix active color sticking to color picker when inactive

This commit is contained in:
lolabird 2023-11-13 03:17:57 -07:00
commit c6fa64c980

View file

@ -180,6 +180,7 @@ function pickBackground() {
} }
} }
function convertHexToRGB(val) { function convertHexToRGB(val) {
hex = val.replace(/^#/, ''); hex = val.replace(/^#/, '');
@ -214,6 +215,7 @@ function adjustTransparency() {
rangeSlider.style.setProperty('--canvas-color', `rgba(${r},${g},${b},${a})`); rangeSlider.style.setProperty('--canvas-color', `rgba(${r},${g},${b},${a})`);
} }
function colorGrid() { function colorGrid() {
if (isRgb) { if (isRgb) {
this.style.backgroundColor = randomizeColor(); this.style.backgroundColor = randomizeColor();
@ -239,6 +241,8 @@ function colorGrid() {
function changeColor() { function changeColor() {
const buttonID = this.id; const buttonID = this.id;
colorPicker.classList.remove ("is-active");
buttons.forEach(btn => btn.classList.remove("is-active")); buttons.forEach(btn => btn.classList.remove("is-active"));
this.classList.add("is-active"); this.classList.add("is-active");