File: //kunden/lib/python3/dist-packages/breezy/__pycache__/terminal.cpython-39.pyc
a
�*�^� � @ sX d dl mZ d dlZd dlZdZdZdd� Zddd d
ddd
dd�Zddd�Zdd� Z dS )� )�absolute_importNZrestructuredtextzTerminal control functionalityc C sV t jdkrdS t j�� sdS dd l} z| �� W n | jyF Y dS 0 t| �d��S )NZwin32Fr Zsetaf) �sys�platform�stdout�isatty�cursesZ setupterm�error�boolZtigetstr)r � r
�1/usr/lib/python3/dist-packages/breezy/terminal.py�has_ansi_colors s
r � 0� 1� 2� 3� 4� 5� 6� 7)ZblackZredZgreenZyellowZblueZmagentaZcyanZwhitec C sv g }|rF|� d�r*|�d� |dd� }n
|�d� |�dt| � |r\|�dt| � d�d d
�|�d| df�S )
a&
Returns a string using ANSI control codes to set the text color.
:param text: The text to set the color for.
:type text: string
:param fgcolor: The foreground color to use
:type fgcolor: string
:param bgcolor: The background color to use
:type bgcolor: string
Zdarkr
� Nr r r � s [� ;� ms [0m)�
startswith�append�colors�join)�textZfgcolorZbgcolor�coder
r
r �colorstring4 s
r c C s. t j�dd�}|�d�s |dkr(d| S t� S )NZTERM� ZxtermZdttermz]0;%s)�os�environ�getr �str)�titleZtermr
r
r �
term_titleP s r&