<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Color Scheme Generator</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
background-color: #F7F7F7;
}
h1 {
font-size: 3rem;
margin-bottom: 2rem;
}
.color-scheme {
display: flex;
margin-bottom: 2rem;
}
.color-box {
width: 10rem;
height: 10rem;
margin-right: 1rem;
border-radius: 1rem;
cursor: pointer;
transition: all 0.3s ease;
}
.color1 {
background-color: #F94144;
}
.color2 {
background-color: #F3722C;
}
.color3 {
background-color: #F9C74F;
}
.color4 {
background-color: #90BE6D;
}
.color5 {
background-color: #43AA8B;
}
.color-box:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}
.generate-btn {
font-size: 2rem;
padding: 0.5rem 1rem;
border: none;
border-radius: 1rem;
background-color: #F94144;
color: #FFFFFF;
cursor: pointer;
transition: all 0.3s ease;
}
.generate-btn:hover {
transform: translateY(-5px);
box-shadow: 0 5px 10px rgba(0,0,0,0.2);
}
</style>
</head>
<body>
<div class="container">
<h1>Color Scheme Generator</h1>
<div class="color-scheme">
<div class="color-box color1"></div>
<div class="color-box color2"></div>
<div class="color-box color3"></div>
<div class="color-box color4"></div>
<div class="color-box color5"></div>
</div>
<button class="generate-btn">Generate</button>
</div>
<script>
// Define the colors
const colors = [
'#F94144',
'#F3722C',
'#F9C74F',
'#90BE6D',
'#43AA8B'
];
// Select the color boxes
const colorBoxes = document.querySelectorAll('.color-box');
// Generate random colors
function generateColors() {
for(let i = 0; i < colorBoxes.length; i++) {
let randomColorIndex = Math.floor(Math.random() * colors.length);
colorBoxes[i].style.backgroundColor = colors[randomColorIndex];
}
}
// Set the initial colors
generateColors();
// Add event listener to the generate button
const generateBtn = document.querySelector('.generate-btn');
generateBtn.addEventListener('click', generateColors);
</script>
</body>
</html>
Discover a collection of free HTML tools to enhance your web development skills. Create amazing websites and boost your productivity with these valuable resources."
Sunday, May 7, 2023
100% Free And Calculator Tool: Easily Calculate AND by Using this Tool and Sart Your Business Now
Subscribe to:
Post Comments (Atom)
100% Free Language Translator Tool: Easily Translate Language by Using this Tool
Language Translator Language Translator Source Language: Afrikaans Albanian Amharic ...
-
Language Translator Language Translator Source Language: Afrikaans Albanian Amharic ...
No comments:
Post a Comment