HEX
Server: LiteSpeed
System: Linux us-phx-web1284.main-hosting.eu 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: u300739242 (300739242)
PHP: 8.2.30
Disabled: system, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
Upload Files
File: //opt/alt/python311/lib/python3.11/site-packages/rich/__pycache__/palette.cpython-311.pyc
�

�;f���(�ddlmZddlmZddlmZmZmZddlm	Z	erddl
mZGd�d��Ze
d	krZdd
lZddlmZddlmZdd
lmZmZddlmZddlmZGd�d��Ze��Ze�e����d
Sd
S)�)�sqrt)�	lru_cache)�Sequence�Tuple�
TYPE_CHECKING�)�ColorTriplet��Tablec��eZdZdZdeeeeeffd�Zdedefd�Z	dd�Z
ed	�
��deeeefdefd���Zd
S)�PalettezA palette of available colors.�colorsc��||_dS�N)�_colors)�selfrs  �?/opt/alt/python311/lib/python3.11/site-packages/rich/palette.py�__init__zPalette.__init__s
��������number�returnc�*�t|j|�Sr)r	r)rrs  r�__getitem__zPalette.__getitem__s���T�\�&�1�2�2rrc
�T�ddlm}ddlm}ddlm}ddlm}|dddd	t|j	���d
�dd�
��}t|j	��D]S\}}|�t|��t|��|d||j|����������T|S)Nr��Color��Style)�Textr
�index�RGBrr
z colorsT�right)�title�caption�	highlight�caption_justifyz                )�bgcolor)�style)�
rich.colorr�
rich.styler�	rich.textr�
rich.tabler�lenr�	enumerate�add_row�str�repr�from_rgb)rrrrr�tabler �colors        r�__rich__zPalette.__rich__s��$�$�$�$�$�$�$�$�$�$�$�$�"�"�"�"�"�"�$�$�$�$�$�$��������4�<�(�(�1�1�1��#�
�
�
��&�d�l�3�3�	�	�L�E�5��M�M��E�
�
��U�����X�U�U�>�5�>�5�3I�%J�%J�%J�K�K�K�
�
�
�
�
�ri)�maxsizer4c��������|\���t�|jj�dtdtf�����fd�}tt
t|j����|���}|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.
        r rc����
|��\}}}�|zdz}�|z
}�|z
}�	|z
}�d|z|z|zdz	d|z|zzd|z
|z|zdz	z��S)zGet the distance to a color.�i��i��)
r �red2�green2�blue2�red_mean�red�green�blue�_sqrt�blue1�	get_color�green1�red1s
        �����r�get_color_distancez)Palette.match.<locals>.get_color_distance:s����"+�)�E�"2�"2��D�&�%��t���)�H���+�C��V�O�E��5�=�D��5���>�S�(�3�.�1�4��e�)�e�#�$��8�^�t�+�d�2�q�8�:���
r)�key)rrr�int�float�min�ranger-)	rr4rI�	min_indexrDrErFrGrHs	    @@@@@r�matchz
Palette.match,s��������$���f�e����L�,�	�	�c�	�e�	�	�	�	�	�	�	�	�	�	���c�$�,�/�/�0�0�6H�I�I�I�	��rN)rr)
�__name__�
__module__�__qualname__�__doc__rrrKrr	rr5rrPr<rrr
r
s�������(�(��x��c�3��m�(<�=�����3�#�3�,�3�3�3�3�����0�Y�t�����5��c�3��/��C��������rr
�__main__N)�Iterabler)�Console�ConsoleOptions)�Segmentrc�.�eZdZdededeefd�ZdS)�ColorBox�console�optionsrc	#�K�|jjdz
}td|��D]�}t|j��D]�}||jz}||dzz}t	j||d��\}}	}
t	j||d|zdzzd��\}}}
t
j|dz|	dz|
dz��}t
j|dz|dz|
dz��}tdt||�����V���tj
��V���dS)	N�rrg�?r9�u▄)r4r')�size�heightrN�	max_width�colorsys�
hls_to_rgbrr2rYr�line)rr\r]rb�y�x�h�l�r1�g1�b1�r2�g2�b2r'r4s                r�__rich_console__zColorBox.__rich_console__Ts+�����\�(�1�,�F��1�f�%�%�	
%�	
%���w�0�1�1�N�N�A��G�-�-�A��V�a�Z�(�A�!)�!4�Q��3�!?�!?�J�B��B�!)�!4�Q��Q��Z�!�^�8L�c�!R�!R�J�B��B�#�n�R�#�X�r�C�x��c��J�J�G�!�N�2��8�R�#�X�r�C�x�H�H�E�!�%��U�G�)L�)L�)L�M�M�M�M�M�M��l�n�n�$�$�$�$�	
%�	
%rN)rQrRrSrWrXrVrYrqr<rrr[r[SsE������
	%�"�
	%�-;�
	%�
�g�
�
	%�
	%�
	%�
	%�
	%�
	%rr[)�mathr�	functoolsr�typingrrr�
color_tripletr	r,rr
rQrdrVr)r�rich.consolerWrX�rich.segmentrYr*rr[r\�printr<rr�<module>rysm��������������1�1�1�1�1�1�1�1�1�1�'�'�'�'�'�'��!� � � � � � �=�=�=�=�=�=�=�=�@�z����O�O�O������� � � � � � �4�4�4�4�4�4�4�4�$�$�$�$�$�$� � � � � � �%�%�%�%�%�%�%�%� �g�i�i�G��M�M�(�(�*�*������3�r