'Get font color for annotations.
The annotated heatmap can feature two text colors: min_text_color and
max_text_color. The min_text_color is applied to annotations for
heatmap values < (max_value - min_value)/2. The user can define these
two colors. Otherwise the colors are defined logically as black or
white depending on the heatmap\'s colorscale.
:rtype (string, string) min_text_color, max_text_color: text
color for annotations for heatmap values <
(max_value - min_value)/2 and text color for annotations for
heatmap values >= (max_value - min_value)/2'

def get_text_color(self):

    colorscales = ['Greys', 'Greens', 'Blues', 'YIGnBu', 'YIOrRd', 'RdBu', 'Picnic', 'Jet', 'Hot', 'Blackbody', 'Earth', 'Electric', 'Viridis']
    colorscales_reverse = ['Reds']
    if self.font_colors:
        min_text_color = self.font_colors[0]
        max_text_color = self.font_colors[(-1)]
    elif ((self.colorscale in colorscales) and self.reversescale):
        min_text_color = '#000000'
        max_text_color = '#FFFFFF'
    elif (self.colorscale in colorscales):
        min_text_color = '#FFFFFF'
        max_text_color = '#000000'
    elif ((self.colorscale in colorscales_reverse) and self.reversescale):
        min_text_color = '#FFFFFF'
        max_text_color = '#000000'
    elif (self.colorscale in colorscales_reverse):
        min_text_color = '#000000'
        max_text_color = '#FFFFFF'
    elif isinstance(self.colorscale, list):
        if ('rgb' in self.colorscale[0][1]):
            min_col = map(int, self.colorscale[0][1].strip('rgb()').split(','))
            max_col = map(int, self.colorscale[(-1)][1].strip('rgb()').split(','))
        elif ('#' in self.colorscale[0][1]):
            min_col = utils.hex_to_rgb(self.colorscale[0][1])
            max_col = utils.hex_to_rgb(self.colorscale[(-1)][1])
        else:
            min_col = [255, 255, 255]
            max_col = [255, 255, 255]
        if ((((min_col[0] * 0.299) + (min_col[1] * 0.587)) + (min_col[2] * 0.114)) > 186):
            min_text_color = '#000000'
        else:
            min_text_color = '#FFFFFF'
        if ((((max_col[0] * 0.299) + (max_col[1] * 0.587)) + (max_col[2] * 0.114)) > 186):
            max_text_color = '#000000'
        else:
            max_text_color = '#FFFFFF'
    else:
        min_text_color = '#000000'
        max_text_color = '#000000'
    return (min_text_color, max_text_color)
