Generate CSS & SCSS Colour Variables
Paste in your hex codes and get back tidy CSS custom properties or SCSS variables in seconds, a quick way to give a website, portfolio or online shop one consistent set of brand colours.
Enter Your Colours
Generated Code
Getting Started
Put each colour on its own line. A bare hex code works, or you can add a label first and separate it from the hex with a comma, such as primary, #2547A0. Pick the output style you want, press Generate Code, then paste what appears into your stylesheet or config file.
A Quick Worked Example
Say you type primary, #2547A0 and secondary, #F6C445 and leave CSS selected. The tool returns a :root block holding --primary: #2547A0; along with --secondary: #F6C445;, so a deep blue and a warm gold, rather like gilded lettering on a navy panel, are ready to drop straight into your styles.
Output Options
You can export as native CSS custom properties (often called CSS variables), as SCSS variables, as LESS variables, or as a colours object for a Tailwind CSS config. Between them, these cover the setups most front-end projects use.
The Benefit of Naming Your Colours
Keeping the whole palette in a single block of variables helps every page of a site or app stay on-brand. If you later decide your gold needs to be a touch warmer, you change it once and the update flows everywhere that variable is used.
Your Questions Answered
What is this generator for?
It takes the hex colours you list and writes them out as CSS, SCSS, LESS or Tailwind code you can paste into a project.
Is giving each colour a name required?
Not at all. Leave the name out and the generator labels that line for you with something simple such as colour-1.
Which code formats can I export?
You can choose native CSS custom properties, SCSS variables, LESS variables, or a colours object for your Tailwind CSS config.
Is there a cap on how many colours I add?
No firm cap applies. Add one colour per line for as many shades as your design calls for.
What if one of my hex codes is wrong?
Any line without a proper three or six digit hex value is simply left out of the generated output.
How do I grab the finished code?
Press the Copy Code button underneath the output box and the whole snippet goes onto your clipboard.
Can my colour names include spaces?
They can. Spaces and any characters a variable name cannot use are swapped for hyphens automatically, so the result stays valid.
Does it cost anything?
Nothing at all, and you will not be asked to register or log in before using it.
Other Handy Colour Tools
All-in-One Colour Format Converter
Switch a colour between hex, RGB, HSL, HSV and CMYK in one place.
Colour Contrast Checker (WCAG)
Make sure your text and background pairings are easy for everyone to read.
Artist Colour Palette Generator
Put together a complete colour scheme for an upcoming artwork.
Monochromatic Palette Generator
Create five soothing shades that all come from one hue.
Take Your Colours Off the Screen
When you are ready to swap code for a brush, our Creative Flair by Sana painting kits pair a curated set of colours with clear, friendly instructions that walk you through each stage.
See Our Painting KitsThe output is written to match the usual syntax rules for CSS, SCSS, LESS and Tailwind CSS. Please check the code yourself before relying on it in a live project.
