Skip to content

Instantly share code, notes, and snippets.

@ngerritsen
Last active September 4, 2020 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngerritsen/466eccd3c8487fd14bf8d4740f644b66 to your computer and use it in GitHub Desktop.
Save ngerritsen/466eccd3c8487fd14bf8d4740f644b66 to your computer and use it in GitHub Desktop.
Get Flat UI Colors as SCSS variables
// Paste the following code in the console on the desired colors page:
[...document.querySelectorAll('.color')].map(color => {
const name = color.textContent
.trim()
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^a-zA-Z0-9-]+/g, '');
const value = color.style.backgroundColor;
return `$color-${name}: ${value};`;
}, '').join('\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment