Skip to main content

🌈 Terminal string styling

Project description

Build Status PyPI version

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

Install

$ pip install style

Usage

import style

print(style.red('Hello', style.bold('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. Styles can be nested.

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.1.4.tar.gz (3.5 kB view hashes)

Uploaded source

Built Distribution

style-1.1.4-py2.py3-none-any.whl (4.1 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page