Skip to content

Commit

Permalink
Merge pull request #17 from wajeehsheikh/master
Browse files Browse the repository at this point in the history
Added Dark Mode to website #12
  • Loading branch information
varlevi committed Oct 29, 2019
2 parents 53715e5 + 47103bd commit 53fa0b6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
23 changes: 23 additions & 0 deletions index.html
Expand Up @@ -25,7 +25,30 @@ <h2>Here are your results:</h2>
<div id="add-js">

</div>

<script src="js/script.js"></script>
<script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.1/lib/darkmode-js.min.js"></script>
<script>
//This uses the cdn above and calls Dark mode and shows widget
new Darkmode().showWidget();
//These are all you widget options
var options = {
bottom: '64px', // default: '32px'
right: 'unset', // default: '32px'
left: '32px', // default: 'unset'
time: '0.5s', // default: '0.3s'
mixColor: '#fff', // default: '#fff'
backgroundColor: '#fff', // default: '#fff'
buttonColorDark: '#100f2c', // default: '#100f2c'
buttonColorLight: '#fff', // default: '#fff'
saveInCookies: false, // default: true,
label: '🌓', // default: ''
autoMatchOsTheme: true // default: true
}
const darkmode = new Darkmode(options);
darkmode.showWidget();

</script>
<footer>
<p class="footer">Copyright &copy 2019 varlevi</p>
</footer>
Expand Down
5 changes: 3 additions & 2 deletions js/script.js
Expand Up @@ -51,7 +51,7 @@ document.getElementsByClassName('submit')[0].addEventListener('click', (event) =

//Initial Color Print
rgbColor = baseColor();
html = `<div style="background-color: ${rgbColor}"></div>`
html = `<div style="background-color: ${rgbColor}" class="darkmode-ignore"></div>`

print( '<h3>Base Color: <br></h3>' );
print( ' </br>' );
Expand All @@ -76,7 +76,7 @@ document.getElementsByClassName('submit')[0].addEventListener('click', (event) =
while (red < 256 && green < 256 && blue < 256) {

rgbColor = baseColor();
html = '<div style="background-color:' + rgbColor + '"></div>';
html = `<div style="background-color: ${rgbColor}" class="darkmode-ignore"></div>`

print( ' </br>' );
printRGB();
Expand All @@ -93,3 +93,4 @@ document.getElementsByClassName('submit')[0].addEventListener('click', (event) =


});

0 comments on commit 53fa0b6

Please sign in to comment.