export function getTextColor ( color ) { const r = parseInt ( color . substr ( 0 , 2 ) , 16 ) ; const g = parseInt ( color . substr ( 2 , 2 ) , 16 ) ; const b = parseInt ( color . substr ( 4 , 2 ) , 16 ) ; const text = ( r * 299 + g * 587 + b * 114 ) / 1000 ; return text >= 128 ? 'black' : 'white' ; } export function getColorNames ( ) { return [ 'red' , 'pink' , 'purple' , 'deep-purple' , 'indigo' , 'blue' , 'light-blue' , 'cyan' , 'teal' , 'green' , 'light-green' , 'lime' , 'yellow' , 'amber' , 'orange' , 'deep-orange' , ] ; } export function getColorTypes ( ) { return [ `50` , '100' , '200' , '300' , '400' , '500' , '600' , '700' , '800' , '900' , 'a100' , 'a200' , 'a400' , 'a700' ] ; } export function getColors ( ) { return [ { group : 'red' , name : 'red-50' , color : '#ffebee' } , { group : 'red' , name : 'red-100' , color : '#ffcdd2' } , { group : 'red' , name : 'red-200' , color : '#ef9a9a' } , { group : 'red' , name : 'red-300' , color : '#e57373' } , { group : 'red' , name : 'red-400' , color : '#ef5350' } , { group : 'red' , name : 'red-500' , color : '#f44336' } , { group : 'red' , name : 'red-600' , color : '#e53935' } , { group : 'red' , name : 'red-700' , color : '#d32f2f' } , { group : 'red' , name : 'red-800' , color : '#c62828' } , { group : 'red' , name : 'red-900' , color : '#b71c1c' } , { group : 'red' , name : 'red-a100' , color : '#ff8a80' } , { group : 'red' , name : 'red-a200' , color : '#ff5252' } , { group : 'red' , name : 'red-a400' , color : '#ff1744' } , { group : 'red' , name : 'red-a700' , color : '#d50000' } , { group : 'pink' , name : 'pink-50' , color : '#fce4ec' } , { group : 'pink' , name : 'pink-100' , color : '#f8bbd0' } , { group : 'pink' , name : 'pink-200' , color : '#f48fb1' } , { group : 'pink' , name : 'pink-300' , color : '#f06292' } , { group : 'pink' , name : 'pink-400' , color : '#ec407a' } , { group : 'pink' , name : 'pink-500' , color : '#e91e63' } , { group : 'pink' , name : 'pink-600' , color : '#d81b60' } , { group : 'pink' , name : 'pink-700' , color : '#c2185b' } , { group : 'pink' , name : 'pink-800' , color : '#ad1457' } , { group : 'pink' , name : 'pink-900' , color : '#880e4f' } , { group : 'pink' , name : 'pink-a100' , color : '#ff80ab' } , { group : 'pink' , name : 'pink-a200' , color : '#ff4081' } , { group : 'pink' , name : 'pink-a400' , color : '#f50057' } , { group : 'pink' , name : 'pink-a700' , color : '#c51162' } , { group : 'purple' , name : 'purple-50' , color : '#f3e5f5' } , { group : 'purple' , name : 'purple-100' , color : '#e1bee7' } , { group : 'purple' , name : 'purple-200' , color : '#ce93d8' } , { group : 'purple' , name : 'purple-300' , color : '#ba68c8' } , { group : 'purple' , name : 'purple-400' , color : '#ab47bc' } , { group : 'purple' , name : 'purple-500' , color : '#9c27b0' } , { group : 'purple' , name : 'purple-600' , color : '#8e24aa' } , { group : 'purple' , name : 'purple-700' , color : '#7b1fa2' } , { group : 'purple' , name : 'purple-800' , color : '#6a1b9a' } , { group : 'purple' , name : 'purple-900' , color : '#4a148c' } , { group : 'purple' , name : 'purple-a100' , color : '#ea80fc' } , { group : 'purple' , name : 'purple-a200' , color : '#e040fb' } , { group : 'purple' , name : 'purple-a400' , color : '#d500f9' } , { group : 'purple' , name : 'purple-a700' , color : '#a0f' } , { group : 'deep-purple' , name : 'deep-purple-50' , color : '#ede7f6' } , { group : 'deep-purple' , name : 'deep-purple-100' , color : '#d1c4e9' } , { group : 'deep-purple' , name : 'deep-purple-200' , color : '#b39ddb' } , { group : 'deep-purple' , name : 'deep-purple-300' , color : '#9575cd' } , { group : 'deep-purple' , name : 'deep-purple-400' , color : '#7e57c2' } , { group : 'deep-purple' , name : 'deep-purple-500' , color : '#673ab7' } , { group : 'deep-purple' , name : 'deep-purple-600' , color : '#5e35b1' } , { group : 'deep-purple' , name : 'deep-purple-700' , color : '#512da8' } , { group : 'deep-purple' , name : 'deep-purple-800' , color : '#4527a0' } , { group : 'deep-purple' , name : 'deep-purple-900' , color : '#311b92' } , { group : 'deep-purple' , name : 'deep-purple-a100' , color : '#b388ff' } , { group : 'deep-purple' , name : 'deep-purple-a200' , color : '#7c4dff' } , { group : 'deep-purple' , name : 'deep-purple-a400' , color : '#651fff' } , { group : 'deep-purple' , name : 'deep-purple-a700' , color : '#6200ea' } , { group : 'indigo' , name : 'indigo-50' , color : '#e8eaf6' } , { group : 'indigo' , name : 'indigo-100' , color : '#c5cae9' } , { group : 'indigo' , name : 'indigo-200' , color : '#9fa8da' } , { group : 'indigo' , name : 'indigo-300' , color : '#7986cb' } , { group : 'indigo' , name : 'indigo-400' , color : '#5c6bc0' } , { group : 'indigo' , name : 'indigo-500' , color : '#3f51b5' } , { group : 'indigo' , name : 'indigo-600' , color : '#3949ab' } , { group : 'indigo' , name : 'indigo-700' , color : '#303f9f' } , { group : 'indigo' , name : 'indigo-800' , color : '#283593' } , { group : 'indigo' , name : 'indigo-900' , color : '#1a237e' } , { group : 'indigo' , name : 'indigo-a100' , color : '#8c9eff' } , { group : 'indigo' , name : 'indigo-a200' , color : '#536dfe' } , { group : 'indigo' , name : 'indigo-a400' , color : '#3d5afe' } , { group : 'indigo' , name : 'indigo-a700' , color : '#304ffe' } , { group : 'blue' , name : 'blue-50' , color : '#e3f2fd' } , { group : 'blue' , name : 'blue-100' , color : '#bbdefb' } , { group : 'blue' , name : 'blue-200' , color : '#90caf9' } , { group : 'blue' , name : 'blue-300' , color : '#64b5f6' } , { group : 'blue' , name : 'blue-400' , color : '#42a5f5' } , { group : 'blue' , name : 'blue-500' , color : '#2196f3' } , { group : 'blue' , name : 'blue-600' , color : '#1e88e5' } , { group : 'blue' , name : 'blue-700' , color : '#1976d2' } , { group : 'blue' , name : 'blue-800' , color : '#1565c0' } , { group : 'blue' , name : 'blue-900' , color : '#0d47a1' } , { group : 'blue' , name : 'blue-a100' , color : '#82b1ff' } , { group : 'blue' , name : 'blue-a200' , color : '#448aff' } , { group : 'blue' , name : 'blue-a400' , color : '#2979ff' } , { group : 'blue' , name : 'blue-a700' , color : '#2962ff' } , { group : 'light-blue' , name : 'light-blue-50' , color : '#e1f5fe' } , { group : 'light-blue' , name : 'light-blue-100' , color : '#b3e5fc' } , { group : 'light-blue' , name : 'light-blue-200' , color : '#81d4fa' } , { group : 'light-blue' , name : 'light-blue-300' , color : '#4fc3f7' } , { group : 'light-blue' , name : 'light-blue-400' , color : '#29b6f6' } , { group : 'light-blue' , name : 'light-blue-500' , color : '#03a9f4' } , { group : 'light-blue' , name : 'light-blue-600' , color : '#039be5' } , { group : 'light-blue' , name : 'light-blue-700' , color : '#0288d1' } , { group : 'light-blue' , name : 'light-blue-800' , color : '#0277bd' } , { group : 'light-blue' , name : 'light-blue-900' , color : '#01579b' } , { group : 'light-blue' , name : 'light-blue-a100' , color : '#80d8ff' } , { group : 'light-blue' , name : 'light-blue-a200' , color : '#40c4ff' } , { group : 'light-blue' , name : 'light-blue-a400' , color : '#00b0ff' } , { group : 'light-blue' , name : 'light-blue-a700' , color : '#0091ea' } , { group : 'cyan' , name : 'cyan-50' , color : '#e0f7fa' } , { group : 'cyan' , name : 'cyan-100' , color : '#b2ebf2' } , { group : 'cyan' , name : 'cyan-200' , color : '#80deea' } , { group : 'cyan' , name : 'cyan-300' , color : '#4dd0e1' } , { group : 'cyan' , name : 'cyan-400' , color : '#26c6da' } , { group : 'cyan' , name : 'cyan-500' , color : '#00bcd4' } , { group : 'cyan' , name : 'cyan-600' , color : '#00acc1' } , { group : 'cyan' , name : 'cyan-700' , color : '#0097a7' } , { group : 'cyan' , name : 'cyan-800' , color : '#00838f' } , { group : 'cyan' , name : 'cyan-900' , color : '#006064' } , { group : 'cyan' , name : 'cyan-a100' , color : '#84ffff' } , { group : 'cyan' , name : 'cyan-a200' , color : '#18ffff' } , { group : 'cyan' , name : 'cyan-a400' , color : '#00e5ff' } , { group : 'cyan' , name : 'cyan-a700' , color : '#00b8d4' } , { group : 'teal' , name : 'teal-50' , color : '#e0f2f1' } , { group : 'teal' , name : 'teal-100' , color : '#b2dfdb' } , { group : 'teal' , name : 'teal-200' , color : '#80cbc4' } , { group : 'teal' , name : 'teal-300' , color : '#4db6ac' } , { group : 'teal' , name : 'teal-400' , color : '#26a69a' } , { group : 'teal' , name : 'teal-500' , color : '#009688' } , { group : 'teal' , name : 'teal-600' , color : '#00897b' } , { group : 'teal' , name : 'teal-700' , color : '#00796b' } , { group : 'teal' , name : 'teal-800' , color : '#00695c' } , { group : 'teal' , name : 'teal-900' , color : '#004d40' } , { group : 'teal' , name : 'teal-a100' , color : '#a7ffeb' } , { group : 'teal' , name : 'teal-a200' , color : '#64ffda' } , { group : 'teal' , name : 'teal-a400' , color : '#1de9b6' } , { group : 'teal' , name : 'teal-a700' , color : '#00bfa5' } , { group : 'green' , name : 'green-50' , color : '#e8f5e9' } , { group : 'green' , name : 'green-100' , color : '#c8e6c9' } , { group : 'green' , name : 'green-200' , color : '#a5d6a7' } , { group : 'green' , name : 'green-300' , color : '#81c784' } , { group : 'green' , name : 'green-400' , color : '#66bb6a' } , { group : 'green' , name : 'green-500' , color : '#4caf50' } , { group : 'green' , name : 'green-600' , color : '#43a047' } , { group : 'green' , name : 'green-700' , color : '#388e3c' } , { group : 'green' , name : 'green-800' , color : '#2e7d32' } , { group : 'green' , name : 'green-900' , color : '#1b5e20' } , { group : 'green' , name : 'green-a100' , color : '#b9f6ca' } , { group : 'green' , name : 'green-a200' , color : '#69f0ae' } , { group : 'green' , name : 'green-a400' , color : '#00e676' } , { group : 'green' , name : 'green-a700' , color : '#00c853' } , { group : 'light-green' , name : 'light-green-50' , color : '#f1f8e9' } , { group : 'light-green' , name : 'light-green-100' , color : '#dcedc8' } , { group : 'light-green' , name : 'light-green-200' , color : '#c5e1a5' } , { group : 'light-green' , name : 'light-green-300' , color : '#aed581' } , { group : 'light-green' , name : 'light-green-400' , color : '#9ccc65' } , { group : 'light-green' , name : 'light-green-500' , color : '#8bc34a' } , { group : 'light-green' , name : 'light-green-600' , color : '#7cb342' } , { group : 'light-green' , name : 'light-green-700' , color : '#689f38' } , { group : 'light-green' , name : 'light-green-800' , color : '#558b2f' } , { group : 'light-green' , name : 'light-green-900' , color : '#33691e' } , { group : 'light-green' , name : 'light-green-a100' , color : '#ccff90' } , { group : 'light-green' , name : 'light-green-a200' , color : '#b2ff59' } , { group : 'light-green' , name : 'light-green-a400' , color : '#76ff03' } , { group : 'light-green' , name : 'light-green-a700' , color : '#64dd17' } , { group : 'lime' , name : 'lime-50' , color : '#f9fbe7' } , { group : 'lime' , name : 'lime-100' , color : '#f0f4c3' } , { group : 'lime' , name : 'lime-200' , color : '#e6ee9c' } , { group : 'lime' , name : 'lime-300' , color : '#dce775' } , { group : 'lime' , name : 'lime-400' , color : '#d4e157' } , { group : 'lime' , name : 'lime-500' , color : '#cddc39' } , { group : 'lime' , name : 'lime-600' , color : '#c0ca33' } , { group : 'lime' , name : 'lime-700' , color : '#afb42b' } , { group : 'lime' , name : 'lime-800' , color : '#9e9d24' } , { group : 'lime' , name : 'lime-900' , color : '#827717' } , { group : 'lime' , name : 'lime-a100' , color : '#f4ff81' } , { group : 'lime' , name : 'lime-a200' , color : '#eeff41' } , { group : 'lime' , name : 'lime-a400' , color : '#c6ff00' } , { group : 'lime' , name : 'lime-a700' , color : '#aeea00' } , { group : 'yellow' , name : 'yellow-50' , color : '#fffde7' } , { group : 'yellow' , name : 'yellow-100' , color : '#fff9c4' } , { group : 'yellow' , name : 'yellow-200' , color : '#fff59d' } , { group : 'yellow' , name : 'yellow-300' , color : '#fff176' } , { group : 'yellow' , name : 'yellow-400' , color : '#ffee58' } , { group : 'yellow' , name : 'yellow-500' , color : '#ffeb3b' } , { group : 'yellow' , name : 'yellow-600' , color : '#fdd835' } , { group : 'yellow' , name : 'yellow-700' , color : '#fbc02d' } , { group : 'yellow' , name : 'yellow-800' , color : '#f9a825' } , { group : 'yellow' , name : 'yellow-900' , color : '#f57f17' } , { group : 'yellow' , name : 'yellow-a100' , color : '#ffff8d' } , { group : 'yellow' , name : 'yellow-a200' , color : '#ff0' } , { group : 'yellow' , name : 'yellow-a400' , color : '#ffea00' } , { group : 'yellow' , name : 'yellow-a700' , color : '#ffd600' } , { group : 'amber' , name : 'amber-50' , color : '#fff8e1' } , { group : 'amber' , name : 'amber-100' , color : '#ffecb3' } , { group : 'amber' , name : 'amber-200' , color : '#ffe082' } , { group : 'amber' , name : 'amber-300' , color : '#ffd54f' } , { group : 'amber' , name : 'amber-400' , color : '#ffca28' } , { group : 'amber' , name : 'amber-500' , color : '#ffc107' } , { group : 'amber' , name : 'amber-600' , color : '#ffb300' } , { group : 'amber' , name : 'amber-700' , color : '#ffa000' } , { group : 'amber' , name : 'amber-800' , color : '#ff8f00' } , { group : 'amber' , name : 'amber-900' , color : '#ff6f00' } , { group : 'amber' , name : 'amber-a100' , color : '#ffe57f' } , { group : 'amber' , name : 'amber-a200' , color : '#ffd740' } , { group : 'amber' , name : 'amber-a400' , color : '#ffc400' } , { group : 'amber' , name : 'amber-a700' , color : '#ffab00' } , { group : 'orange' , name : 'orange-50' , color : '#fff3e0' } , { group : 'orange' , name : 'orange-100' , color : '#ffe0b2' } , { group : 'orange' , name : 'orange-200' , color : '#ffcc80' } , { group : 'orange' , name : 'orange-300' , color : '#ffb74d' } , { group : 'orange' , name : 'orange-400' , color : '#ffa726' } , { group : 'orange' , name : 'orange-500' , color : '#ff9800' } , { group : 'orange' , name : 'orange-600' , color : '#fb8c00' } , { group : 'orange' , name : 'orange-700' , color : '#f57c00' } , { group : 'orange' , name : 'orange-800' , color : '#ef6c00' } , { group : 'orange' , name : 'orange-900' , color : '#e65100' } , { group : 'orange' , name : 'orange-a100' , color : '#ffd180' } , { group : 'orange' , name : 'orange-a200' , color : '#ffab40' } , { group : 'orange' , name : 'orange-a400' , color : '#ff9100' } , { group : 'orange' , name : 'orange-a700' , color : '#ff6d00' } , { group : 'deep-orange' , name : 'deep-orange-50' , color : '#fbe9e7' } , { group : 'deep-orange' , name : 'deep-orange-100' , color : '#ffccbc' } , { group : 'deep-orange' , name : 'deep-orange-200' , color : '#ffab91' } , { group : 'deep-orange' , name : 'deep-orange-300' , color : '#ff8a65' } , { group : 'deep-orange' , name : 'deep-orange-400' , color : '#ff7043' } , { group : 'deep-orange' , name : 'deep-orange-500' , color : '#ff5722' } , { group : 'deep-orange' , name : 'deep-orange-600' , color : '#f4511e' } , { group : 'deep-orange' , name : 'deep-orange-700' , color : '#e64a19' } , { group : 'deep-orange' , name : 'deep-orange-800' , color : '#d84315' } , { group : 'deep-orange' , name : 'deep-orange-900' , color : '#bf360c' } , { group : 'deep-orange' , name : 'deep-orange-a100' , color : '#ff9e80' } , { group : 'deep-orange' , name : 'deep-orange-a200' , color : '#ff6e40' } , { group : 'deep-orange' , name : 'deep-orange-a400' , color : '#ff3d00' } , { group : 'deep-orange' , name : 'deep-orange-a700' , color : '#dd2c00' } , { group : 'brown' , name : 'brown-50' , color : '#efebe9' } , { group : 'brown' , name : 'brown-100' , color : '#d7ccc8' } , { group : 'brown' , name : 'brown-200' , color : '#bcaaa4' } , { group : 'brown' , name : 'brown-300' , color : '#a1887f' } , { group : 'brown' , name : 'brown-400' , color : '#8d6e63' } , { group : 'brown' , name : 'brown-500' , color : '#795548' } , { group : 'brown' , name : 'brown-600' , color : '#6d4c41' } , { group : 'brown' , name : 'brown-700' , color : '#5d4037' } , { group : 'brown' , name : 'brown-800' , color : '#4e342e' } , { group : 'brown' , name : 'brown-900' , color : '#3e2723' } , { group : 'grey' , name : 'grey-50' , color : '#fafafa' } , { group : 'grey' , name : 'grey-100' , color : '#f5f5f5' } , { group : 'grey' , name : 'grey-200' , color : '#eee' } , { group : 'grey' , name : 'grey-300' , color : '#e0e0e0' } , { group : 'grey' , name : 'grey-400' , color : '#bdbdbd' } , { group : 'grey' , name : 'grey-500' , color : '#9e9e9e' } , { group : 'grey' , name : 'grey-600' , color : '#757575' } , { group : 'grey' , name : 'grey-700' , color : '#616161' } , { group : 'grey' , name : 'grey-800' , color : '#424242' } , { group : 'grey' , name : 'grey-900' , color : '#212121' } , { group : 'blue-grey' , name : 'blue-grey-50' , color : '#eceff1' } , { group : 'blue-grey' , name : 'blue-grey-100' , color : '#cfd8dc' } , { group : 'blue-grey' , name : 'blue-grey-200' , color : '#b0bec5' } , { group : 'blue-grey' , name : 'blue-grey-300' , color : '#90a4ae' } , { group : 'blue-grey' , name : 'blue-grey-400' , color : '#78909c' } , { group : 'blue-grey' , name : 'blue-grey-500' , color : '#607d8b' } , { group : 'blue-grey' , name : 'blue-grey-600' , color : '#546e7a' } , { group : 'blue-grey' , name : 'blue-grey-700' , color : '#455a64' } , { group : 'blue-grey' , name : 'blue-grey-800' , color : '#37474f' } , { group : 'blue-grey' , name : 'blue-grey-900' , color : '#263238' } , ] . map ( ( item ) => ( { ... item , text : getTextColor ( item . color . replace ( '#' , '' ) ) } ) ) ; }