Created
October 28, 2022 20:54
-
-
Save Nemikolh/2108e14705f27e9b80a1314531d4fe5e to your computer and use it in GitHub Desktop.
Tailwind extract color palette to visualize them in https://palettte.app/
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
#!/usr/bin/env node | |
import colors from 'tailwindcss/colors.js'; | |
const res = []; | |
for (const color in colors) { | |
const colorVariants = colors[color]; | |
if (typeof(colorVariants) !== 'object') { | |
continue; | |
} | |
res.push({ | |
paletteName: color, | |
swatches: Object.keys(colorVariants).map(cv => ({ name: color + " " + cv, color: colorVariants[cv] })), | |
}); | |
} | |
console.log(JSON.stringify(res)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment