Skip to main content

Add color codes to strings or print in color.

Project description

incolor

Description

Very simple package that aims at adding some color to Your life.

Quickstart

  • Add color codes to text (uses color numbers)
>>> from incolor import incolor
>>> incolor(4, 'I\'m blue da ba dee')
"\x1b[34mI'm blue da ba dee\x1b[0m"
  • Add color codes to text (uses color names)
>>> from incolor import incolor, Color
>>> incolor(Color.blue, 'I\'m blue da ba dee')
"\x1b[34mI'm blue da ba dee\x1b[0m"
  • Join multiple arguments in colorful manner
>>> incolor(Color.brwhite, 'First', 2, 'third', list())
'\x1b[315mFirst 2 third []\x1b[0m'
  • Color print function (behaves exactly like print(incolor(...)) ) (the is yellow here)
>>> cprint(3, 'Yellow: 🚢', 123, 'yay')
Yellow: 🚢 123 yay
  • Both functions accept sep argument
>>> incolor(0, 'a', 1, 2, sep='\t')
'\x1b[30ma\t1\t2\x1b[0m'
>>> cprint(0, 'a', 1, 2, sep='\t')
a       1       2

Tests

To run tests execute test.sh script

./test.sh

Prerequisites:

  • docker
  • Internet connection 😃

#TODO

  • add colors only if output is a TTY
  • verify Windows support (probably not working?)
  • add more ways to specify colors (f.e. from string: 'red')
  • add support for 256 colors
  • add support for Truecolor

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

incolor-0.2.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

incolor-0.2-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file incolor-0.2.tar.gz.

File metadata

  • Download URL: incolor-0.2.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2

File hashes

Hashes for incolor-0.2.tar.gz
Algorithm Hash digest
SHA256 ad677978987744c39564194a19990b17a9392c58cbb6e8fca58b2fb0ece19597
MD5 af1b86b9e67633a424b1eba27de24d64
BLAKE2b-256 d619ea19a288fa468ec3f7e52498e1ccb429fd38962d92ff15aaee562d1f00b3

See more details on using hashes here.

File details

Details for the file incolor-0.2-py3-none-any.whl.

File metadata

  • Download URL: incolor-0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.2

File hashes

Hashes for incolor-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 163e843882d1570e7b36031410c7053c041d044ab79abde792bc6ebb9bfd28cb
MD5 6387803c15eeb6ad154a0d98740a6932
BLAKE2b-256 e598bb7315c85e322524974685c04613d5c3154f635d1f436874e139163d3d31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page