DEV Community

threadspeed
threadspeed

Posted on

1 1

Terminal style with Python

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

Install the module style with pip:

$ pip install style

Usage is like this:

import style
print(style.red('Hello', style.bold('world') + '!'))

Some messing around with the Python shell:

text color python

Styles available:

  • bold
  • dim
  • italic
  • underline
  • inverse
  • hidden
  • strikethrough

Colors available:

  • 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

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay