Last active
September 4, 2020 07:30
-
-
Save ngerritsen/466eccd3c8487fd14bf8d4740f644b66 to your computer and use it in GitHub Desktop.
Get Flat UI Colors as SCSS variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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