Skip to main content

Colorisation de texte dans un terminal

Project description

zpp-color

Informations

Librairie pour la colorisation de texte dans un terminal.
Permet de modifier la couleur du texte, la couleur de fond et le style.
Prise en charge de 256 couleurs.
Sélection de la couleur avec le nom, l'id ou une combinaison RGB

Prérequis

  • Python 3

Installation

pip install zpp_color

Utilisation

Conseil d'importation du module

from zpp_color import fg, bg, attr

Modification de la couleur du texte

Avec le nom
print(f"{fg('blue')}Ceci est un texte en bleu{attr(0)}")
Avec l'id
print(f"{fg(3)}Ceci est un texte en bleu{attr(0)}")
Avec un code RGB
print(f"{fg('0,0,255')}Ceci est un texte en bleu{attr(0)}")

NOTE: Toujours rajouter attr(0) à la fin du texte, sinon la couleur s'appliquera pour les lignes suivantes.


Modification de la couleur de fond

Avec le nom
print(f"{bg('red')}Ceci est un texte avec un fond rouge{attr(0)}")
Avec l'id
print(f"{bg(1)}Ceci est un texte avec un fond rouge{attr(0)}")
Avec un code RGB
print(f"{bg('255,0,0')}Ceci est un texte avec un fond rouge{attr(0)}")

Modification du style du texte

Avec le nom
print(f"{attr('italic')}Ceci est un texte en italic{attr(0)}")
Avec l'id
print(f"{attr(3)}Ceci est un texte en italic{attr(0)}")

Lister les possibilités

Lister les couleurs possibles
zpp_color.list_fg()
zpp_color.list_bg()
Lister les styles possibles
zpp_color.list_attr()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zpp_color-1.0.3.tar.gz (4.5 kB view hashes)

Uploaded Source

Built Distribution

zpp_color-1.0.3-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page