title: Dark mode theme ASP.NET MVC
body: <p>I am building a web application and would like to give the user the option to toggle the theme from the original one to a Dark Mode one.</p>
  
  <p>I have two different .css files, one for the original theme and one for the dark mode one, but I don't know how to implement such a button.</p>
  
  <p>For now I have the function:</p>
  
  <pre><code>function updateStyleSheet(filename) {
  
          newstylesheet = "Content/" + filename + ".css";
          if ($("#dynamic_css").length == 0) {
              $("head").append("&lt;link&gt;")
              css = $("head").children(":last");
              css.attr({
                  id: "dynamic_css",
                  rel: "stylesheet",
                  type: "text/css",
                  href: newstylesheet
              });
          } else {
              $("#dynamic_css").attr("href", newstylesheet);
          }
  
      }
  </code></pre>
  
  <p>And I call it using:</p>
  
  <pre><code>&lt;input type="button" onclick="updateStyleSheet('bootstrap-SUPERHER')" value="Dark Mode"&gt;
  </code></pre>
  
  <p>However, when I go on another page the theme goes back to the original one. How do I make it be constant?</p>
  
  <p>Any help is highly appreciated.</p>