dark, light) { color = color.replace(/[^0-9a-f]/ig, '').toUpperCase(); let r = parseInt(color.substring(0, 2), 16), g = parseInt(color.substring(2, 4), 16), b = parseInt(color.substring(4, 6), 16); let returnColor; if (dark && light) { returnColor = ((r + g + b) / 3) > (255 / 2) ? dark : light; } else { returnColor = 'rgb(' + (255 - r) + ',' + (255 - g) + ',' + (255 - b) + ')'; } return returnColor; }; }; export default inverseColor;