Skip to main content

A terminal string styling library

Project description

Simple Chalk

Note: This document is best viewed on github. Pypi's headers are all caps which presents inaccurate information"

Table of Contents


What is it?

A terminal string styling library for python. It implements a subset of Sindre Sorhus' chalk (which is for js).

e.g."success") prints like you'd expect in the console.

Why create it?

I am familiar with and enjoy the syntax of chalk. Anthonyalmarza's chalk deviates from that syntax and so I created my own.

I'm also new to python so this was a good way to learn.

Why the subset of features?

I only use chalk for very simple purposes so I left out things like 256 colors.


$ pip install simple_chalk


from simple_chalk import chalk, green

# both of these are the same

# chained

# assign combinations
success = green.bold.underline
print(success("we did it!"))

# last color wins
print("this is red"))

# background and foreground colors are separate
whyNot =
print(whyNot("this is red text with a gray background"))


simple_chalk exports the following

chalk (string) => string
  • A singleton that can be used instead of importing the colors and styles directly.
  • chalk and all exported colors/styles are chainable callables. When called, they take a single string argument and return a string wrapped in the appropriate ascii color codes.
newChalk () => Chalk
  • You probably don't need this, but it creates a new chalk instance in case another library is misbehaving.

The following colors are exported

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • blackBright (also 'gray' and 'grey')
  • redBright
  • greenBright
  • yellowBright
  • blueBright
  • magentaBright
  • cyanBright
  • whiteBright

Each color also has a camel-cased bg equivalent. e.g. bgBlack and bgYellowBright

Finally the following miscellaneous styles are exported

  • bold
  • dim
  • underline
  • hidden


hub clone olsonpm/py_simple-chalk
cd py_simple-chalk

Features included from js version of Chalk

  • chainable api
  • same color names (with added aliases)

Features omitted

** Features marked with * are ones I'd pull in should someone create a PR.

  • 256 colors and TrueColor support
  • multiple arguments, and thus nested styles
  • *color support detection
  • *blue -> blueBright auto conversion on windows
  • *ability to disable
  • *modifiers other than the miscellaneous styles noted above. e.g. reset, italic, inverse etc.

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

simple_chalk-0.1.0.tar.gz (13.9 kB view hashes)

Uploaded source

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