Turn a saved color list into reusable CSS properties
Admin ·
When several components share an accent, a named custom property gives them one value to reference. This exporter assigns names by the position of each color in the list.
Create a solid accent and a translucent overlay
Enter #369 on the first line and rgba(51, 102, 153, 0.5) on the second. Set the prefix to brand. The declarations give --brand-1 the value #336699 and --brand-2 the value rgba(51, 102, 153, 0.5).
Use a variable in a component
Load the downloaded stylesheet before your component styles. In the component, use color: var(--brand-1) and background-color: var(--brand-2). The :root declarations make these properties available to descendants through inheritance.
Keep published numbers stable
Insert a new color at the end to preserve earlier names. Inserting one at the start shifts the numbers of all later entries and changes the colors existing references pick up.
Update a shared palette without swapping button colors
Suppose --brand-1 supplies the button background and --brand-2 supplies its text. Reversing two input lines changes both consumers when the stylesheet reloads, even if the color list itself contains exactly the same values.
Compare the generated stylesheet with the previous export by variable name. For a new accent, appending it preserves the meaning of existing numbers. Test the button in its hover and disabled states as well.
Common questions
Can I paste commas between colors?
Put each color on its own line. Commas inside an RGB or HSL function belong to that one color.
Why does the stylesheet disappear when a line is invalid?
Fix the indicated color entry to restore the complete export. This prevents saving a palette with a silently skipped variable.