Build a tool that generates harmonious color palettes with hex codes and export options
Create a color palette generator that produces aesthetically pleasing color schemes. Users can generate random palettes, lock specific colors, and export palettes for use in design projects.
To get started, you can use the following code snippet to generate colors:
function generateRandomColor() {
return '#' + Math.floor(Math.random()*16777215).toString(16).padStart(6, '0');
}
function generatePalette(count = 5) {
const palette = [];
for (let i = 0; i < count; i++) {
palette.push(generateRandomColor());
}
return palette;
}
function generateComplementaryPalette(baseColor) {
const hsl = hexToHsl(baseColor);
const complementary = [(hsl[0] + 180) % 360, hsl[1], hsl[2]];
return [baseColor, hslToHex(complementary)];
}