function() { // 移除所有按钮的选中状态 colorButtons.forEach(b => b.classList.remove('ring -4', 'ring-gray-200')); // 添加当前按钮的选中状态 this.classList.add('ring-4', 'ring-gray updateChart(); }); }); // 默认选中第一个颜色 colorButtons[0].classList.add('ring Math.floor(Math.random() * colorButtons.length)]; colorButtons.forEach(b => b.classList.remove('ring -4', 'ring-gray-200')); randomColor.classList.add('ring-4', 'ring-gray-200'); waterColor