Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

Suggested Dark Mode <Code>

  • So I think Opera GX needs better dark mode. Here's the code in HTML, CSS, JS!

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
    body {
      padding: 25px;
      background-color: #f2f2f2;
      color: #616161;
      font-size: 25px;
    }
    
    .dark-mode {
      background-color: #616161;
      color: #f2f2f2;
    }
    </style>
    </head>
    <body>
    
    <p>Dark Mode</p>
    <button onclick="myFunction()">Toggle dark mode</button>
    
    <script>
    function myFunction() {
       var element = document.body;
       element.classList.toggle("dark-mode");
    }
    </script>
    
    </body>
    </html>
    

    Hope u like it! Test the code at something like repl.it or w3schools.com

  • @tennysongardi said in Suggested Dark Mode <Code>:

    So I think Opera GX needs better dark mode. Here's the code in HTML, CSS, JS!

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
    body {
      padding: 25px;
      background-color: #f2f2f2;
      color: #616161;
      font-size: 25px;
    }
    
    .dark-mode {
      background-color: #616161;
      color: #f2f2f2;
    }
    </style>
    </head>
    <body>
    
    <p>Dark Mode</p>
    <button onclick="myFunction()">Toggle dark mode</button>
    
    <script>
    function myFunction() {
       var element = document.body;
       element.classList.toggle("dark-mode");
    }
    </script>
    
    </body>
    </html>
    

    Hope u like it! Test the code at something like repl.it or w3schools.com

    After uploading an image, my browser closed and updated itself(wtf?)

    I figured the update was rolled back (because I can't use the clipboard to upload a picture anymore), so please restore it.

    But the dark mode is still there; I'm not sure if that bug has been patched, but it seems to be working fine so far.