Jump to content

Darkmode


acegoal07

Recommended Posts

I am unclear about your question.

But the more I understood, the more I would explain. Here is my code for darkmode option.

Example :

<style>
        body {
            padding: 25px;
            background-color: white;
            color: black;
            font-size: 25px;
        }

        .dark-mode {
            background-color: black;
            color: white;
        }
    </style>

<body>

<h2>Dark mode</h2>

<p>tap the button.</p>

<button onclick="myFunction()">dark mode</button>

<script>

function myFunction() {
            var element = document.body;
            element.classList.toggle("dark-mode");
        }

</script>

</body>

I hope you'll understand.

If you have any doubt then you can freely ask.

Thank You.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...