© Copyright - 4 ECO
document.addEventListener('DOMContentLoaded', function() { const building = document.getElementById('building'); const colorPicker = document.getElementById('colorPicker'); const colorIcons = document.querySelectorAll('.colorIcon'); console.log('Building element:', building); console.log('Color picker:', colorPicker); console.log('Color icons:', colorIcons); function changeColor(color) { console.log('Changing color to:', color); if (building) { building.style.backgroundColor = color; } else { console.error('Building element not found'); } if (colorPicker) { colorPicker.value = color; } else { console.error('Color picker not found'); } } if (colorPicker) { colorPicker.addEventListener('input', function() { changeColor(this.value); }); } colorIcons.forEach(icon => { icon.addEventListener('click', function() { const color = this.getAttribute('data-color'); console.log('Clicked color:', color); changeColor(color); }); }); });