Last active
July 6, 2019 09:03
-
-
Save darraghmckay/9f8982609bdbf595cb1f79a84b4385b8 to your computer and use it in GitHub Desktop.
JS to export flatuicolors.com pallet to javascript contants
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
$$('.color').map(element => ({ color: element.getAttribute('style'), name: element.textContent.trim()})).map(({color, name}) => `export const ${name.replace(/[ -]/g, '_').replace(/'/g, '').toUpperCase()} = '${/background: (.+);/.exec(color)[1].replace(';', '')}';`).join('\n'); | |
/* | |
Example on this pallet https://flatuicolors.com/palette/us | |
export const LIGHT_GREENISH_BLUE = 'rgb(85, 239, 196)'; | |
export const FADED_POSTER = 'rgb(129, 236, 236)'; | |
export const GREEN_DARNER_TAIL = 'rgb(116, 185, 255)'; | |
export const SHY_MOMENT = 'rgb(162, 155, 254)'; | |
export const CITY_LIGHTS = 'rgb(223, 230, 233)'; | |
export const MINT_LEAF = 'rgb(0, 184, 148)'; | |
export const ROBINS_EGG_BLUE = 'rgb(0, 206, 201)'; | |
export const ELECTRON_BLUE = 'rgb(9, 132, 227)'; | |
export const EXODUS_FRUIT = 'rgb(108, 92, 231)'; | |
export const SOOTHING_BREEZE = 'rgb(178, 190, 195)'; | |
export const SOUR_LEMON = 'rgb(255, 234, 167)'; | |
export const FIRST_DATE = 'rgb(250, 177, 160)'; | |
export const PINK_GLAMOUR = 'rgb(255, 118, 117)'; | |
export const PICO_8_PINK = 'rgb(253, 121, 168)'; | |
export const AMERICAN_RIVER = 'rgb(99, 110, 114)'; | |
export const BRIGHT_YARROW = 'rgb(253, 203, 110)'; | |
export const ORANGEVILLE = 'rgb(225, 112, 85)'; | |
export const CHI_GONG = 'rgb(214, 48, 49)'; | |
export const PRUNUS_AVIUM = 'rgb(232, 67, 147)'; | |
export const DRACULA_ORCHID = 'rgb(45, 52, 54)'; | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment