Created
          February 13, 2019 01:25 
        
      - 
      
 - 
        
Save mhanberg/b7a72cf685a77ba4c11b30494754ea69 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | function toggleTheme() { | |
| const theme = window.localStorage.getItem("theme"); | |
| if (theme === "light") { | |
| setTheme("#262b2f", "white", "๐", "dark"); | |
| } else { | |
| setTheme("white", "#262b2f", "๐", "light"); | |
| } | |
| } | |
| function setTheme(background, text, toggleText, theme) { | |
| document.body.style.setProperty("--background-color", background); | |
| document.body.style.setProperty("--text-color", text); | |
| document.getElementById("theme-btn").innerText = toggleText; | |
| window.localStorage.setItem("theme", theme); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment