Sha256: 32b0d47579c85574026bde7a85ac4c27dfad73126a765c26b5648cd40a06e8f4
Contents?: true
Size: 855 Bytes
Versions: 1
Compression:
Stored size: 855 Bytes
Contents
function onLoad() { var themeSelector = document.getElementById('themeSelector'); console.log('inside on load method'); for (var themeName in themeMap) { console.log('inside loop' + ' ' + themeName); var opt = document.createElement('option'); opt.value = themeName; opt.innerHTML = capitalizeFirstLetter(themeName); themeSelector.appendChild(opt); } } function toggleTheme() { var themeName = themeSelector.value; var element = document.getElementsByTagName('html')[0]; changeTheme(element, themeMap[themeName]); } function changeTheme(element, theme) { element.style.setProperty("--primary-background-color", theme['background-color']); element.style.setProperty("--primary-text-color", theme['text-color']); } function capitalizeFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dev-portfolio-blog-0.1.4 | assets/js/script.js |