HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_vendor/rich/__pycache__/palette.cpython-38.pyc
U

�{�eD
�@s�ddlmZddlmZddlmZmZmZddlm	Z	erHddl
mZGdd�d�Ze
d	kr�dd
lZddlmZddlmZdd
lmZmZddlmZddlmZGdd�d�Ze�Ze�e��d
S)�)�sqrt)�	lru_cache)�Sequence�Tuple�
TYPE_CHECKING�)�ColorTriplet��Tablec@sneZdZdZeeeeefd�dd�Zeed�dd�Z	dd	�d
d�Z
edd
�eeeefed�dd��ZdS)�PalettezA palette of available colors.)�colorscCs
||_dS�N)�_colors)�selfr�r�</tmp/pip-unpacked-wheel-_0scjqea/pip/_vendor/rich/palette.py�__init__szPalette.__init__)�number�returncCst|j|�Sr
)rr)rrrrr�__getitem__szPalette.__getitem__r
)rc
Cs�ddlm}ddlm}ddlm}ddlm}|dddd	t|j	��d
�ddd
�}t
|j	�D]2\}}|�t|�t
|�|d||j|�d�d��q\|S)Nr��Color��Style)�Textr	�indexZRGBrrz colorsT�right)�title�captionZ	highlightZcaption_justifyz                )�bgcolor)�style)�pip._vendor.rich.colorr�pip._vendor.rich.stylerZpip._vendor.rich.textr�pip._vendor.rich.tabler
�lenr�	enumerateZadd_row�str�repr�from_rgb)rrrrr
�tabler�colorrrr�__rich__s(�	�zPalette.__rich__i)�maxsize)r*rcsL|\���t�|jj�ttd������fdd�}ttt|j��|d�}|S)z�Find a color from a palette that most closely matches a given color.

        Args:
            color (Tuple[int, int, int]): RGB components in range 0 > 255.

        Returns:
            int: Index of closes matching color.
        )rrcsj�|�\}}}�|d}�|}�|}�|}�d|||d?d||d|||d?�S)zGet the distance to a color.�i��i�r)rZred2Zgreen2Zblue2Zred_meanZredZgreenZblue��_sqrtZblue1Z	get_colorZgreen1Zred1rr�get_color_distance:s
���z)Palette.match.<locals>.get_color_distance)�key)rrr�int�float�min�ranger$)rr*r2Z	min_indexrr0r�match,s


z
Palette.matchN)
�__name__�
__module__�__qualname__�__doc__rrr4rrrr+rr8rrrrrsr�__main__N)�Iterabler)�Console�ConsoleOptions)�Segmentrc@s"eZdZeeeed�dd�ZdS)�ColorBox)�console�optionsrccs�|jjd}td|�D]�}t|j�D]�}||j}||d}t�||d�\}}	}
t�||d|dd�\}}}
t�|d|	d|
d�}t�|d|d|
d�}tdt	||d��Vq$t�
�VqdS)	N�rrg�?r-�u▄)r*r)�size�heightr7�	max_width�colorsysZ
hls_to_rgbrr(rAr�line)rrCrDrH�y�x�h�lZr1Zg1Zb1Zr2Zg2Zb2rr*rrr�__rich_console__Ts
 zColorBox.__rich_console__N)r9r:r;r?r@r>rArPrrrrrBSs�rB)�mathr�	functoolsr�typingrrrZ
color_tripletrr#r
rr9rJr>r!rZpip._vendor.rich.consoler?r@Zpip._vendor.rich.segmentrAr"rrBrC�printrrrr�<module>s @