├── index.html ├── script.js └── style.css /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Theme Change 5 | 6 | 7 | 8 | 9 | 10 |
11 |

Welcome to Creator Aashu

12 | 13 | 14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /script.js: -------------------------------------------------------------------------------- 1 | function changeTheme(theme) { 2 | var body = document.body; 3 | 4 | if (theme === "dark") { 5 | body.classList.add("dark"); 6 | } else { 7 | body.classList.remove("dark"); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: lightgray; 3 | padding: 10%; 4 | } 5 | 6 | h1 { 7 | color: black; 8 | } 9 | 10 | .dark { 11 | background-color: black; 12 | color: white; 13 | } 14 | 15 | .dark h1 { 16 | color: white; 17 | } --------------------------------------------------------------------------------