Skip to content

Instantly share code, notes, and snippets.

@Nemikolh
Created October 28, 2022 20:54
Show Gist options
  • Save Nemikolh/2108e14705f27e9b80a1314531d4fe5e to your computer and use it in GitHub Desktop.
Save Nemikolh/2108e14705f27e9b80a1314531d4fe5e to your computer and use it in GitHub Desktop.
Tailwind extract color palette to visualize them in https://palettte.app/
#!/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