Dark mode toolger


<button id="dark-mode-toggle">Dark</button>
<script>
    // References
    let body = document.body;
    let darkModeToggle = document.getElementById('dark-mode-toggle');

    // Add 'dark-mode' class to body on page load
    document.addEventListener('DOMContentLoaded', function() {



      //agar starting me hi dark mode enable chahiye to niche wala rhega
      body.classList.add('dark-mode');
    });

    // Dark mode toggle button click event
    darkModeToggle.addEventListener('click', function() {
      body.classList.toggle('dark-mode');
    });

    // Your existing JavaScript code continues below
    // ...
  </script>


/* Dark mode styles */
    body.dark-mode {
      background: #000;
      color: #fff;
    }

    .dark-mode button {
      box-shadow: 0.3rem 0.3rem 0.5rem rgba(15, 13, 18, 0.49), -0.2rem -0.2rem 0.4rem dimgrey;

    }