<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Theme Switcher Example</title> <style> * { background-color: var(--background-color); color: var(--foreground-color); } body { font-family: Arial, sans-serif; } button { padding: 10px; margin: 5px; cursor: pointer; border-radius: 25px; } .theme-light { --background-color: #f0f0f0; --foreground-color: #333; } .theme-dark { --background-color: #333; --foreground-color: #f0f0f0; } .theme-flame { --background-color: orange; --foreground-color: red; } </style> </head> <body> <script> // a theme is saved in localStorage ( or default ) setTheme(localStorage.getItem('theme') || "light"); function setTheme(theme) { document.body.classList.remove('theme-' + localStorage.getItem('theme')); localStorage.setItem('theme', theme); document.body.classList.add('theme-' + theme); } </script> <h1>Theme Switcher Example</h1> <p>Click the buttons below to switch themes:</p> <button onclick="setTheme('light')">Light Theme</button> <button onclick="setTheme('dark')">Dark Theme</button> <button onclick="setTheme('flame')">Flame Theme</button> <hr> <script src="https://arkenidar.com/web/show-source.js"></script> </body> </html>