def _parse_color_string(colors, n=None, r=False, start=0, stop=1):
    """
    Parses strings that are formatted like the following:

    'RdBu_r_start=0.8_stop=0.9_n=10'
    'viridis_start0.2_r_stop.5_n20'
    'Greens_start0_n15'
    """
    if isinstance(colors, str):
        color_settings = colors.split('_')
        colors = color_settings[0]
        for setting in color_settings[1:]:
            setting = setting.replace('=', '')
            if setting.startswith('n') and setting[1].isdigit():
                n = int(setting[1:])
            elif setting == 'r':
                r = True
            elif setting.startswith('start'):
                start = float(setting[5:])
            elif setting.startswith('stop'):
                stop = float(setting[4:])
    return colors, n, r, start, stop