style is a simple terminal string styling package. Its API is a port of the popular chalk package for javascript.
$ pip install style
import style
print(style.red('Hello', style.bold('world') + '!'))
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.
Color support is automatically detected, but can also be changed manually.
- set
style.enabled
toTrue
orFalse
- use the command line parameter
--color
or--no-color
Modifiers | Colors | Background colors | ||
---|---|---|---|---|
|
|
|
|
|