makeColors.js
1 import tailwindColors from 'tailwindcss/colors'; 2 3 // array of duplicated colors to exclude 4 const excludeColors = [ 5 'primary', 6 'secondary', 7 'positive', 8 'negative', 9 'warning', 10 'info' 11 ] 12 13 const makeColors = () => { 14 delete tailwindColors['lightBlue']; 15 delete tailwindColors['warmGray']; 16 delete tailwindColors['trueGray']; 17 delete tailwindColors['coolGray']; 18 delete tailwindColors['blueGray']; 19 20 const colors = Object.entries(tailwindColors).flatMap(([name, values]) => { 21 if (typeof values === 'string' || excludeColors.includes(name)) { 22 return [] 23 } 24 return Object.entries(values).map(([tonality, hex]) => ({ 25 name: `${name}-${tonality}`, 26 value: hex, 27 })) 28 }) 29 30 return colors 31 } 32 33 export default makeColors;