Created
August 29, 2024 09:44
-
-
Save callezenwaka/336a11010403ece09a42c4f4e0970902 to your computer and use it in GitHub Desktop.
This is theme selection html boilerplate.
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>HTML 5 Boilerplate</title> | |
<link rel="stylesheet" href="style.css"> | |
<style> | |
:root { | |
--primary-color: #ffffff; | |
--secondary-color: #f5f5f5; | |
--tertiary-color: #000000de; | |
--button-color: #d1d5db; | |
} | |
.dark-theme { | |
--primary-color: #111111; | |
--secondary-color: #212121; | |
--tertiary-color: #CFCDD6; | |
--button-color: #111111; | |
} | |
</style> | |
<script> | |
function setTheme{}(){ | |
const theme = document.body.getAttribute('data-theme-light') === 'true' ? 'light' : 'dark'; | |
if (theme === 'dark') document.body.classList.add('dark-theme'); | |
else document.body.classList.remove('dark-theme'); | |
} | |
</script> | |
</head> | |
<body> | |
<h1>Salut!</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment