diff --git a/index.html b/index.html index 24b05e0..da9280a 100644 --- a/index.html +++ b/index.html @@ -952,39 +952,49 @@ var weatherThemes = { var themeColors = getEffectiveThemeColors(); if (themeColors) { - var keys = ['skyColor', 'cloudColor', 'cloudShadowColor', 'sunColor', 'sunGlareColor', 'sunlightColor', 'backgroundColor']; - var keyMap = {skyColor: 'sky', cloudColor: 'cloud', cloudShadowColor: 'cloudShadow', sunColor: 'sun', sunGlareColor: 'sunGlare', sunlightColor: 'sunLight', backgroundColor: 'bg'}; + var keys = ['skyColor', 'cloudColor', 'lightColor', 'backgroundColor']; + var keyMap = {skyColor: 'sky', cloudColor: 'cloud', lightColor: 'sunLight', backgroundColor: 'bg'}; for (var i = 0; i < keys.length; i++) { var k = keys[i]; var kk = keyMap[k]; var c = themeColors[k]; - document.getElementById('dbg-t-' + kk).style.backgroundColor = '#' + ('00000' + c.toString(16)).slice(-6); - document.getElementById('dbg-h-' + kk).textContent = '#' + ('00000' + c.toString(16)).slice(-6); + if (kk === 'sunLight') { + document.getElementById('dbg-t-sunLight').style.backgroundColor = '#' + ('00000' + c.toString(16)).slice(-6); + document.getElementById('dbg-h-sunLight').textContent = '#' + ('00000' + c.toString(16)).slice(-6); + } else { + document.getElementById('dbg-t-' + kk).style.backgroundColor = '#' + ('00000' + c.toString(16)).slice(-6); + document.getElementById('dbg-h-' + kk).textContent = '#' + ('00000' + c.toString(16)).slice(-6); + } } } if (vantaColors) { - var vKeys = ['sky', 'cloud', 'cloudShadow', 'sun', 'sunGlare', 'sunLight', 'bg']; + var vKeys = ['sky', 'cloud', 'light', 'bg']; + var vKeyMap = {sky: 'sky', cloud: 'cloud', light: 'sunLight', bg: 'bg'}; for (var j = 0; j < vKeys.length; j++) { var vk = vKeys[j]; var vc = vantaColors[vk]; - document.getElementById('dbg-v-' + vk).style.backgroundColor = '#' + ('00000' + vc.toString(16)).slice(-6); - document.getElementById('dbg-vh-' + vk).textContent = '#' + ('00000' + vc.toString(16)).slice(-6); + var kk = vKeyMap[vk]; + if (kk === 'sunLight') { + document.getElementById('dbg-v-sunLight').style.backgroundColor = '#' + ('00000' + vc.toString(16)).slice(-6); + document.getElementById('dbg-vh-sunLight').textContent = '#' + ('00000' + vc.toString(16)).slice(-6); + } else { + document.getElementById('dbg-v-' + kk).style.backgroundColor = '#' + ('00000' + vc.toString(16)).slice(-6); + document.getElementById('dbg-vh-' + kk).textContent = '#' + ('00000' + vc.toString(16)).slice(-6); + } } } } function animate() { - var t = getCurrentDayProgress(); + var elapsed = (Date.now() - startTime) % CYCLE; + var t = elapsed / CYCLE; var c = getColor(t); c = applyWeatherTheme(c); effect.setOptions({ skyColor: c.sky, cloudColor: c.cloud, - cloudShadowColor: c.cloudShadow, - sunColor: c.sun, - sunGlareColor: c.sunGlare, - sunlightColor: c.sunLight, + lightColor: c.light, backgroundColor: c.bg, speed: currentThemeSpeed });