def next_color():
    """
    Return the next color in the plot color cycle.

    Example::

        from matplotlib import pyplot as plt
        from bumps.plotutil import next_color, dhsv
        color = next_color()
        plt.errorbar(x, y, yerr=dy, fmt='.', color=color)
        # Draw the theory line with the same color as the data, but darker
        plt.plot(x, y, '-', color=dhsv(color, dv=-0.2))
    """
    import pylab
    lines = pylab.gca()._get_lines
    try:
        base = next(lines.prop_cycler)['color']
    except Exception:
        try:
            base = next(lines.color_cycle)
        except Exception:
            base = lines._get_next_cycle_color()
    return base
