HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/pip/_vendor/rich/__pycache__/palette.cpython-37.pyc
B

L��gD
�@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-hv55ucu3/pip/_vendor/rich/palette.py�__init__szPalette.__init__)�number�returncCst|j|�S)N)rr)r
rrrr�__getitem__szPalette.__getitem__r	)rc
Cs�ddlm}ddlm}ddlm}ddlm}|dddd	t|j	��d
�ddd
�}x@t
|j	�D]2\}}|�t|�t
|�|d||j|�d�d��q^W|S)Nr)�Color)�Style)�Text)r	�indexZRGBrr
z 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)r
rrrr	�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)�_sqrt�blue1�	get_color�green1�red1rr�get_color_distance:sz)Palette.match.<locals>.get_color_distance)�key)rrr�int�float�min�ranger )r
r&r1Z	min_indexr)r,r-r.r/r0r�match,s


z
Palette.matchN)
�__name__�
__module__�__qualname__�__doc__rrr3rrrr'rr7rrrrr
sr
�__main__N)�Iterable)r)�Console�ConsoleOptions)�Segment)rc@s"eZdZeeeed�dd�ZdS)�ColorBox)�console�optionsrccs�|jjd}x�td|�D]�}x�t|j�D]�}||j}||d}t�||d�\}}	}
t�||d|dd�\}}}
t�|d|	d|
d�}t�|d|d|
d�}tdt	||d��Vq(Wt�
�VqWdS)	N�rrg�?r)�u▄)r&r)�size�heightr6�	max_width�colorsysZ
hls_to_rgbrr$r@r�line)r
rBrCrG�y�x�h�lZr1Zg1Zb1Zr2Zg2Zb2rr&rrr�__rich_console__Ts
 zColorBox.__rich_console__N)r8r9r:r>r?r=r@rOrrrrrASsrA)�mathr�	functoolsr�typingrrrZ
color_tripletrrr	r
r8rIr=rrZpip._vendor.rich.consoler>r?Zpip._vendor.rich.segmentr@rrrArB�printrrrr�<module>s @