beacon_aug/external/textflow/effects.py
def triangle_color(self, col1, col2):
        """
        Returns a color which is "opposite" to both col1 and col2.
        """
        col1, col2 = np.array(col1), np.array(col2)
        col1 = np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_RGB2HSV))
        col2 = np.squeeze(cv2.cvtColor(col2[None, None, :], cv2.COLOR_RGB2HSV))
        h1, h2 = col1[0], col2[0]
        if h2 < h1:
            h1, h2 = h2, h1  # swap
        dh = h2 - h1
        if dh < 127:
            dh = 255 - dh
        col1[0] = h1 + dh / 2
        return np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_HSV2RGB))

        Returns a color which is "opposite" to both col1 and col2.
        
Returns a color which is "opposite" to both col1 and col2.
Returns a color which is " opposite " to both col1 and col2 .
def triangle_color(self, col1, col2):
        col1, col2 = np.array(col1), np.array(col2)
        col1 = np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_RGB2HSV))
        col2 = np.squeeze(cv2.cvtColor(col2[None, None, :], cv2.COLOR_RGB2HSV))
        h1, h2 = col1[0], col2[0]
        if h2 < h1:
            h1, h2 = h2, h1  
        dh = h2 - h1
        if dh < 127:
            dh = 255 - dh
        col1[0] = h1 + dh / 2
        return np.squeeze(cv2.cvtColor(col1[None, None, :], cv2.COLOR_HSV2RGB))
def triangle_color ( self , col1 , col2 ) : col1 , col2 = np . array ( col1 ) , np . array ( col2 ) col1 = np . squeeze ( cv2 . cvtColor ( col1 [ None , None , : ] , cv2 . COLOR_RGB2HSV ) ) col2 = np . squeeze ( cv2 . cvtColor ( col2 [ None , None , : ] , cv2 . COLOR_RGB2HSV ) ) h1 , h2 = col1 [ 0 ] , col2 [ 0 ] if h2 < h1 : h1 , h2 = h2 , h1 dh = h2 - h1 if dh < 127 : dh = 255 - dh col1 [ 0 ] = h1 + dh / 2 return np . squeeze ( cv2 . cvtColor ( col1 [ None , None , : ] , cv2 . COLOR_HSV2RGB ) )
Returns a color which is "opposite" to both col1 and col2.
Returns a color which is " opposite " to both col1 and col2 .
"""
        Returns a color which is "opposite" to both col1 and col2.
        """ # swap
self
col1
col2