import { getContrastRatio } from '@material-ui/core/styles';

/**
 * @param {string} background
 * @param {*} [options]
 * @param {string} [options.darkColor]
 * @param {string} [options.lightColor]
 * @param {string} [options.threshold]
 * @return {string}
 */
export default function getContrastText(background, options = {}) {
    const { darkColor = '#000000', lightColor = '#ffffff', threshold = 10 } = options;
    return getContrastRatio(background, darkColor) >= threshold ? darkColor : lightColor;
}
