Calculator Tools Calculator Tools
Create

Dynamic Color Generator

Aug 12, 2026

About this app

A fun web app that generates random colors and allows users to save their favorite colors.

Dynamic Color Generator Random Color Generator Click "Generate Color" to start! Generate Color Save this Color Favorite Colors:

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Dynamic Color Generator</title>
<meta name="description" content="A fun web app that generates random colors and allows users to save their favorite colors.">
<meta name="keywords" content="color generator, color palette, random colors, beauty, design, creative">

<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">

<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
const colorContainer = $("#color-container");
const favoritesContainer = $("#favorites");
const generateButton = $("#generate-color");
const saveButton = $("#save-color");
let currentColor;

function generateColor() {
const randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
currentColor = randomColor;
colorContainer.css("background-color", randomColor).text(randomColor);
}

generateButton.on("click", generateColor);
saveButton.on("click", function() {
if (currentColor) {
favoritesContainer.append(`<div class="favorite-color" style="background-color: ${currentColor};">${currentColor} <button class="btn btn-danger btn-sm remove-favorite">Remove</button></div>`);
$(".remove-favorite").on("click", function() {
$(this).parent().remove();
});
}
});

generateColor(); // Generate an initial color
});

} catch (error) {
throw error;
}
</script>

<style>
body {
background: linear-gradient(to right, #ff7e5f, #feb47b);
color: white;
font-family: 'Arial', sans-serif;
text-align: center;
padding: 50px;
}
#color-container {
margin: auto;
padding: 40px;
border-radius: 10px;
transition: all 0.5s;
font-size: 2em;
}
#favorites {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.favorite-color {
padding: 10px;
border-radius: 5px;
color: white;
display: flex;
align-items: center;
justify-content: space-between;
transition: transform 0.3s;
}
.favorite-color:hover {
transform: scale(1.05);
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Random Color Generator</h1>
<div id="color-container">Click "Generate Color" to start!</div>
<button id="generate-color" class="btn btn-light">Generate Color</button>
<button id="save-color" class="btn btn-success">Save this Color</button>
<h2>Favorite Colors:</h2>
<div id="favorites"></div>
</div>
</body>
</html>