diff --git a/examples/index.html b/examples/index.html index 7b84f3fea8..3d13f1db45 100644 --- a/examples/index.html +++ b/examples/index.html @@ -25,6 +25,7 @@ + @@ -55,9 +56,19 @@ +
+
This is an open source toolkit which you can help improve on Github
diff --git a/examples/theme.css b/examples/theme.css new file mode 100644 index 0000000000..74129440d2 --- /dev/null +++ b/examples/theme.css @@ -0,0 +1,67 @@ +#theme-toggler { + opacity: 0; + position: absolute; +} + +.label { + background-color: #445; + border-radius: 50px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: space-between; + padding: 5px; + position: relative; + height: 2.6rem; + width: 5rem; + transform: scale(1.5); +} + +.label .slider { + background-color: #fff; + border-radius: 50%; + position: absolute; + top: 2px; + left: 2px; + height: 22px; + width: 22px; + transform: translateX(0px); + transition: transform 0.2s linear; +} + +#theme-toggler:checked + .label .slider { + transform: translateX(24px); +} + +.fa-moon-o { + font-size:1.4rem; + color: #f39c12; +} + +.fa-sun-o { + font-size:1.4rem; + color: #f39c12; +} + +/* main stuff to be darkened */ + +body.dark-theme{ + background-color: #292C35; +} + +.dark-theme { + color: #000; +} + +.dark-theme-spec { + color: #fff; +} + +h2.dark-theme,h1 a.dark-theme { + color: #0ad7fa; + /* color: #fa9b0a; */ +} + +div.dark-panel-theme { + color: #808080; +} diff --git a/src/ui/toggleTheme.js b/src/ui/toggleTheme.js new file mode 100644 index 0000000000..37522d0fac --- /dev/null +++ b/src/ui/toggleTheme.js @@ -0,0 +1,42 @@ +document.addEventListener('DOMContentLoaded',function() { + document.getElementById('theme-toggler').addEventListener('change',function() { + + let color,bgcolor,sepColor; + + document.querySelector('body').classList.toggle('dark-theme'); + document.querySelector('.name-header').classList.toggle('dark-theme'); + + document.querySelectorAll('h2').forEach(function(heading) { + heading.classList.toggle('dark-theme'); + }); + + document.querySelector('header').classList.toggle('dark-theme-spec'); + document.querySelector('#dropzone-text i').classList.toggle('dark-theme-spec'); + document.querySelector('.text-muted').classList.toggle('dark-theme-spec'); + + document.querySelector('div.panel-body').classList.toggle('dark-theme'); + document.querySelector('input[type="file"]').classList.toggle('dark-theme-spec'); + + if(document.getElementById('version-number-top-right').className.indexOf('dark-theme-spec') == -1){ + color = '#fff'; + bgcolor = '#fff'; + sepColor = '#000'; + } + else{ + color = '#808080'; + bgcolor = '#000'; + sepColor = '#fff'; + } + + document.getElementById('update-prompt-modal').style.backgroundColor = bgcolor; + document.getElementById('update-prompt-modal').style.color = sepColor; + document.getElementById('version-number-top-right').style.color = color; + document.getElementById('version-number-text').style.color = color; + document.querySelector('#move-up i').style.color = color; + + document.getElementById('version-number-top-right').classList.toggle('dark-theme-spec'); + document.getElementById('update-prompt-modal').classList.toggle('dark-theme-spec'); + document.getElementById('version-number-text').classList.toggle('dark-theme-spec'); + document.querySelector('#move-up i').classList.toggle('dark-theme-spec'); + }); +});