CSS colour variables from an image
Custom properties make a palette easy to reuse and change. Drop an image and get a :root block with one variable per colour, named from the nearest colour name and written in the format you prefer. Nothing is uploaded: your image stays in your browser.
Drop an image here
Or paste one with Ctrl+V. PNG, JPG, WebP, GIF, AVIF or BMP, up to 25 MB.
More palette ideas
How it works
Add an image
Drop a picture on the page, paste it with Ctrl+V, or browse for a file. A logo, a photo, a screenshot or a product shot all work.
Choose how many colours
Pick 4, 6, 8 or 10. The most common colours come first, with the share of the image each one covers, so you can see which colour leads.
Pick, scale and copy
Click the image to pick any exact pixel with a magnifier, open an eleven-step tonal scale for any colour, and show the colours as HEX, RGB, HSL or OKLCH.
Export it
Copy the palette as CSS variables, a Tailwind theme, SCSS, JSON or plain text, download it as a file, or save a PNG strip of the colours.
Questions about a CSS colour variables
How do I get a CSS colour variables from an image?
Add your image, and 6 colours are chosen for you. You can change that to 4, 6, 8 or 10. Then open Export, choose CSS variables and copy the code. OKLCH values let you change lightness while the hue stays steady, which is handy for hover and dark mode variants.
Should I use HEX or OKLCH in my custom properties?
HEX works everywhere. OKLCH is supported by current browsers and is better when you want to adjust lightness, so use it for new projects and keep HEX as a fallback if you support old browsers.
How many colours should a CSS colour variables have?
Six variables are easy to manage. If you need more, add the extra colours with the pixel picker so you only keep ones you will use.
Is the image I use for my CSS colour variables uploaded?
No. The picture is read by your own browser in a background worker, so your CSS colour variables stays private and the page keeps working offline once it has loaded.
More free tools
View all toolsAbout these tools
Small tools, made by Sifency
Sifency is a small studio that builds themes, plugins and web apps. These tools began as the things we kept needing ourselves, so we tidied them up and left them open for everyone. There is nothing to sign up for.