Code HTML Dark Mode Sederhana
Berikut kodenya:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Dark Mode Sederhana</title>
<!-- Dark mode style -->
<style>
body {
color: #fff;
background-color: #333;
}
/* Styles for light mode */
body.light-mode {
color: #333;
background-color: #fff;
}
</style>
</head>
<body class="light-mode">
<!-- Dark mode toggle button -->
<button id="dark-mode-toggle">Dark mode</button>
<!-- Page content -->
<h1>Halaman dengan dark mode sederhana</h1>
<p>Ini adalah konsep HTML untuk implementasi dark mode sederhana.</p>
<!-- Dark mode script -->
<script>
const darkModeToggle = document.getElementById('dark-mode-toggle');
const body = document.body;
darkModeToggle.addEventListener('click', () => {
body.classList.toggle('light-mode');
});
</script>
</body>
</html>