gbowne1 / spmssite

The code for my old business website.
GNU General Public License v3.0
8 stars 31 forks source link

Add light/dark mode toggle in about.html #61

Closed meikei-99 closed 2 years ago

meikei-99 commented 2 years ago

*This is my first time opening a pull request, please advise me if I have made any mistakes.

I have added a light/dark toggle on the about.html page. If everything is all right, I will then proceed to add them to the rest of the HTML page.

salehghulamqasim commented 2 years ago

you can simply put dark mode properties in css


dark-mode {
  background-color: black;
  color: white;
}

then in html body link that with the javascript function

<button onclick="darkMode()"> Dark mode</button>

and then in script make this funtion

  <script>
            function darkMode() {
                var element = document.body;
                element.classList.toggle("dark-mode");
            }
  </script>
gbowne1 commented 2 years ago

I thought I read about something maybe on stackoverflow where you would write code that would detect the users preffered theme.

That is an option if it works.

gbowne1 commented 2 years ago

@meikei-99 that worked in the About page about.html I was able to test it.

Thanks for the PR!