o
    ŒQUJ:  ã                   @   sV   d Z dadd„ Zdd„ ZdZdZdd	d
ddddœZdd„ Zdd„ Zdd„ Z	dd„ Z
dS )zf
Colored output for unix shells, which can be disabled to avoid problems on
non-supporting platforms.
Tc                   C   ó   da dS )z3Enable colorized output from this module's methods.TN©Ú_enableColor© r   r   úG/var/www/html/env/lib/python3.10/site-packages/consoleLog/shellColor.pyÚenableColor   ó   r   c                   C   r   )z4Disable colorized output from this module's methods.FNr   r   r   r   r   ÚdisableColor   r   r   z
[01;%.2dmz[01;00mé    é   é   é    é!   é"   )ÚregularÚdarkgreyÚredÚ
lightgreenÚyellowÚbluec                 C   s>   t  |¡}|du rtd| ƒ‚trtt |  |  td  S | S )z‹
    Changes the color of the given string as printed on a UNIX shell.

    >>> color('dog', 'blue') == '[01;34mdog[01;00m'
    True
    Nzno color matches name: %sr	   )Ú_colorsÚgetÚKeyErrorr   Ú
_colString)ÚstrObjÚcolorÚcoder   r   r   r   3   s   
r   c                 C   s   t rtt|   S dS )z_ Change the color for the remaining text after this is printed to the
        given color.
    Ú )r   r   Úcolors)r   r   r   r   ÚchangeColorF   s   r   c                 C   s`   d}d}d}|   ||¡}|dkr&||| 7 }|ttƒ }|   ||¡}|dks|t| ƒ| 7 }|S )zÂ
    Determine the real length of a string object.

    >>> realLen('dog gone')
    8
    >>> realLen(color('dog', 'blue') + ' gone')
    8
    >>> realLen('[01;34mdog[01;00m gone')
    8
    r	   z[01;éÿÿÿÿ)ÚfindÚlenÚ_resetString)r   ÚfinalLenÚ
startIndexÚcolorStrÚ	nextColorr   r   r   ÚrealLenR   s   ýr'   c                   C   s   t rtS dS )zG
    Return the string to print to reset the color to the default.
    r   )r   r"   r   r   r   r   Ú
resetColorn   s   r(   N)Ú__doc__r   r   r   r   r"   r   r   r   r'   r(   r   r   r   r   Ú<module>   s"   ú