Skip to main content

Easily print colored text to the console

Project description


colorise provides easy cross-platform text coloring for terminals/consoles and has been tested on different platforms/terminals.

Installation

Install colorise via pip.

pip install colorise

To get started check out the docs, tutorial or the examples.

Features

  • Supports 8, 16, 88, 256 colors and true-color.
  • Colors can be specified by name, index, hexadecimal, HLS, HSV or RGB formats.
>>> colorise.cprint('Hello', fg='red')
>>> colorise.cprint('Hello', bg=201)
>>> colorise.cprint('Hello', fg='#a696ff')
>>> colorise.cprint('Hello', bg='0xa696ff')
>>> colorise.cprint('Hello', fg='hls(0.6923;0.7960;1.0)')
>>> colorise.cprint('Hello', fg='hsv(249;41;100)')
>>> colorise.cprint('Hello', bg='rgb(167;151;255)')
>>> colorise.fprint('{fg=red}Hello {bg=blue}world!')
  • Automatically find the closest color based on the terminal's capabilities. Below is sprite of a familiar plumber. Pixels are specified as RGB so colorise automatically approximates colors for 256 and 16 color indices in the two right-most images.
From left to right: True-color, 256 color and 16 color.

  • Useful functions like highlight that highlights individual characters in a string given a list of indices.
  • Support for attributes such as bold, italic, underline etc.
>>> colorise.highlight('Hello world', indices=[0, 2, 3, 7, 9], attributes=[Attr.Italic])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for colorise, version 1.0.1
Filename, size File type Python version Upload date Hashes
Filename, size colorise-1.0.1-py3-none-any.whl (21.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size colorise-1.0.1.tar.gz (190.4 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page