(cls, color1, color2, pass_through=False)
return cls(friendly_name, name, palette,
                   flags=Palette.Diverging if pass_through else Palette.NoFlags)
Deprecated constructor for tests and easier migration from
        Variable.color. Constructs a palette that goes from color1 to color2.

        pass_throug can be a color through which the palette will pass,
        or `True` to pass through black. Default is `False`.
Deprecated constructor for tests and easier migration from
        Variable.color. Constructs a palette that goes from color1 to color2.
Deprecated constructor for tests and easier migration from Variable . color . Constructs a palette that goes from color1 to color2 .
def from_colors(cls, color1, color2, pass_through=False):
        """
        Deprecated constructor for tests and easier migration from
        Variable.color. Constructs a palette that goes from color1 to color2.

        pass_throug can be a color through which the palette will pass,
        or `True` to pass through black. Default is `False`.
        """
        if pass_through is True:
            colors = (color1, (0, 0, 0), color2)
            xf = [0, 127, 255]
        elif pass_through:
            assert isinstance(pass_through, tuple)
            colors = (color1, pass_through, color2)
            xf = [0, 127, 255]
        else:
            colors = (color1, color2)
            xf = [0, 255]
        name = repr(colors)
        friendly_name = "Custom"
        x = np.arange(256)
        r = np.interp(x, xf, np.array([color[0] for color in colors]))
        g = np.interp(x, xf, np.array([color[1] for color in colors]))
        b = np.interp(x, xf, np.array([color[2] for color in colors]))
        palette = np.vstack((r, g, b)).T
        return cls(friendly_name, name, palette,
                   flags=Palette.Diverging if pass_through else Palette.NoFlags)
def from_colors ( cls , color1 , color2 , pass_through = False ) : if pass_through is True : colors = ( color1 , ( 0 , 0 , 0 ) , color2 ) xf = [ 0 , 127 , 255 ] elif pass_through : assert isinstance ( pass_through , tuple ) colors = ( color1 , pass_through , color2 ) xf = [ 0 , 127 , 255 ] else : colors = ( color1 , color2 ) xf = [ 0 , 255 ] name = repr ( colors ) friendly_name = "Custom" x = np . arange ( 256 ) r = np . interp ( x , xf , np . array ( [ color [ 0 ] for color in colors ] ) ) g = np . interp ( x , xf , np . array ( [ color [ 1 ] for color in colors ] ) ) b = np . interp ( x , xf , np . array ( [ color [ 2 ] for color in colors ] ) ) palette = np . vstack ( ( r , g , b ) ) . T return cls ( friendly_name , name , palette , flags = Palette . Diverging if pass_through else Palette . NoFlags )