Skip to main content

🌈 Terminal string styling

Project description

Build Status PyPI version

style is a simple terminal string styling library. Its API is a port of the popular chalk module for javascript.

Install

$ pip install style

Usage

import style

print(style.red.bold('Hello world!'))

API

style.style*[.style](*objects, sep=' ')

Chain styles and call the last one as a method with an argument. Order doesn’t matter, and later styles take precedence in case of a conflict, e.g. style.red.yellow.green is equivalent to style.green.

Multiple arguments will be separated by sep, a space by default.

style.enabled

Color support is automatically detected, but can also be changed manually.

  • set style.enabled to True or False

  • use the command line parameter --color or --no-color

Styles

Modifiers

Colors

Background colors

  • bold

  • dim

  • italic

  • underline

  • inverse

  • hidden

  • strikethrough

  • black

  • red

  • green

  • yellow

  • blue

  • magenta

  • cyan

  • white

  • light_black

  • light_red

  • light_green

  • light_yellow

  • light_blue

  • light_magenta

  • light_cyan

  • light_white

  • on_black

  • on_red

  • on_green

  • on_yellow

  • on_blue

  • on_magenta

  • on_cyan

  • on_white

  • on_light_black

  • on_light_red

  • on_light_green

  • on_light_yellow

  • on_light_blue

  • on_light_magenta

  • on_light_cyan

  • on_light_white

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

style-1.0.4.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

style-1.0.4-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file style-1.0.4.tar.gz.

File metadata

  • Download URL: style-1.0.4.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for style-1.0.4.tar.gz
Algorithm Hash digest
SHA256 d8979d9f48802cf8fd7fa7702207b8487328f374a1c6c91eb00683f8826c0d12
MD5 28d69328c468eeb2c5b43257113a3ab0
BLAKE2b-256 ba8ee045f8142c58dab9b70a9500ca70321145ec6bf02d37ae6e1d8b55b95815

See more details on using hashes here.

File details

Details for the file style-1.0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for style-1.0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2afc8ce245d76b8e1a6486adb125436f62cfd59690023c5b7bb7d5715fb36d8f
MD5 49222a80a09d89326f90cda4a9fb6b58
BLAKE2b-256 9998ba5ecba2a0a8bb77888f0d962d7e6d22dcd5569f79a0c7119002acc7c61c

See more details on using hashes here.

Supported by

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