def assign_continuous_colors(data, gg, aes_name, color_col, labels, indices):
    """
    Logic to assign colors in the continuous case.

    Handle continuous colors here. We're going to use whatever colormap
    is defined to evaluate for each value. We're then going to convert
    each color to HEX so that it can fit in 1 column. This will make it
    much easier when creating layers. We're also going to evaluate the
    quantiles for that particular column to generate legend scales. This
    isn't what ggplot does, but it's good enough for now.

    Parameters
    ----------
    data : DataFrame
        dataframe which should have shapes assigned to
    gg : ggplot object
        It holds the colormap
    color_col : The column we are using to color.
    aes_name : string
        Which aesthetic needs a color mapping; 'color' | 'fill'
    labels : [string]
        A list of legend labels
    indices : [int]
        The percentile indices used to generate the labels

    Returns
    -------
    data : DataFrame
        the changed dataframe
    legend_entry : dict
        An entry into the legend dictionary.
        Documented in `components.legend`
    """
    _mcolumn = ':::%s_mapping:::' % aes_name
    min_val = data[color_col].min()
    max_val = data[color_col].max()
    values = (data[color_col] - min_val) / (max_val - min_val)
    values = values.tolist()
    color_mapping = gg.colormap(values)[::, :3]
    data[_mcolumn] = [rgb2hex(value) for value in color_mapping]
    key_colors = gg.colormap(indices)[::, :3]
    key_colors = [rgb2hex(value) for value in key_colors]

    legend_entry = {'column_name': color_col,
                    'dict' : dict(zip(key_colors, labels)),
                    'scale_type': 'continuous'}
    return data, legend_entry
dataset/ETHPy150Open yhat/ggplot/ggplot/components/colors.py/assign_continuous_colors/original