def diverging_palette(h_neg, h_pos, s=75, l=50, sep=10, n=6, center='light', as_cmap=False):
 palfunc = (dark_palette if (center == 'dark') else light_palette)
 neg = palfunc((h_neg, s, l), (128 - (sep / 2)), reverse=True, input='husl')
 pos = palfunc((h_pos, s, l), (128 - (sep / 2)), input='husl')
 midpoint = dict(light=[(0.95, 0.95, 0.95, 1.0)], dark=[(0.133, 0.133, 0.133, 1.0)])[center]
 mid = (midpoint * sep)
 pal = blend_palette(np.concatenate([neg, mid, pos]), n, as_cmap=as_cmap)
 return pal

def diverging_palette ( h_neg , h_pos , s = 75 , l = 50 , sep = 10 , n = 6 , center = 'light' , as_cmap = False ) : palfunc = ( dark_palette if ( center == 'dark' ) else light_palette ) neg = palfunc ( ( h_neg , s , l ) , ( 128 - ( sep / 2 ) ) , reverse = True , input = 'husl' ) pos = palfunc ( ( h_pos , s , l ) , ( 128 - ( sep / 2 ) ) , input = 'husl' ) midpoint = dict ( light = [ ( 0.95 , 0.95 , 0.95 , 1.0 ) ] , dark = [ ( 0.133 , 0.133 , 0.133 , 1.0 ) ] ) [ center ] mid = ( midpoint * sep ) pal = blend_palette ( np . concatenate ( [ neg , mid , pos ] ) , n , as_cmap = as_cmap ) return pal
make a diverging palette between two husl colors .