This project extracts color palettes from images, providing a set of dominant and complementary colors in multiple formats. It's designed to help designers, developers, and creatives quickly capture the essence of an image’s color scheme.
- Color Extraction: Uses ColorThief to find the dominant color and a palette of top colors from each image.
- Multiple Outputs: Generates:
- A
.pngpalette preview - A
.jsonfile with RGB + HEX values - A
.cssfile with ready-to-use CSS variables
- A
- Batch Processing: Automatically processes every image in the
inputfolder. - Organized Output: Each image gets its own subfolder in
outputwith all generated files.
- Clone this repository to your local machine.
- Install the required Python dependencies using
pip install pipenv && pipenv install.
- Place your input images in the
inputfolder. - Run the script
main.py. - Generated files will be saved in the
outputfolder.
For each image in input/, the following will be created in output//:
- palette.json: List of colors in RGB and HEX
- palette.css: CSS variables for easy use in styling
- palette.png: Visual swatch of the palette
{
"dominant_color": {
"rgb": [
228,
157,
63
],
"hex": "#e49d3f"
},
"palette": [
{
"rgb": [223,141,34],
"hex": "#df8d22"
},
{
"rgb": [242,216,186],
"hex": "#f2d8ba"
},
{
"rgb": [241,190,124],
"hex": "#f1be7c"
},
{
"rgb": [142,66,10],
"hex": "#8e420a"
},
{
"rgb": [146,86,32],
"hex": "#925620"
},
{
"rgb": [251,217,122],
"hex": "#fbd97a"
}
]
}--color1: #df8d22;
--color2: #f2d8ba;
--color3: #f1be7c;
--color4: #8e420a;
--color5: #925620;
--color6: #fbd97a;- ColorThief – For color extraction.
- Pillow (PIL Fork) – For image handling.
- Matplotlib – For palette visualization.

