python-kolors
Simple and lightweight shell color output function.
It also checks if terminal supports color before vomitting ANSI codes.
Usage
from kolors import c
print c('Some <red>Red</end> and <blue>blue</end> text')
print c('<green bg>Some green background</end>')
print c('Some <cyan bold bg>{}</end>').format('interpolation')
Colors
grey (alias: gray)
red
green
yellow
blue
magenta (alias: purple)
cyan
white
Styles
bold
bg
Roadmap
Not sure where this project will go, but suggestions and pull requests are welcome.
The features bellow were suggested, I’m seriously considering them for the next iterations.
Use curses
import curses
curses.setupterm()
if curses.tigetstr('setf') is not None:
# Red foreground, if supported.
print (curses.tparm(curses.tigetstr('setf'), curses.COLOR_RED).decode('utf-8'))
>From man 5 terminfo:
To change the current foreground or background color on a Tek‐ tronix-type terminal, use setaf (set ANSI foreground) and setab (set ANSI background) or setf (set foreground) and setb (set back‐ ground). These take one parameter, the color number. The SVr4 documentation describes only setaf/setab; the XPG4 draft says that “If the terminal supports ANSI escape sequences to set background and foreground, they should be coded as setaf and setab, respec‐ tively.
Note: thanks u/awegge!
Cleaner, nestable syntax
<fg red>Red text<b>Red bold text <bg blue>Red bold tect on Blue background</bg>red bold again</b>Just red again </fg>
Wrapping around other libraries
Like colorama & click.style
Metadata
Release files for kolors 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kolors-0.0.4.tar.gz | 3.6 kB | Without provenance | Details for kolors-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kolors-0.0.4-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for kolors-0.0.4-py2.py3-none-any.whl |
Total release size: 8.6 kB
Release files / kolors-0.0.4.tar.gz
| Download URL | kolors-0.0.4.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02c3307f16735688fc919d3c6dc1bab660e0468e6d7cad89f5c36ffce0296b45
|
|
BLAKE2b-256 checksum How to use checksums |
92d39cd4c765ef85fc9cd5c1ff63b6be79430002aea59d457845602f7a59f9fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / kolors-0.0.4-py2.py3-none-any.whl
| Download URL | kolors-0.0.4-py2.py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
e861b1a96a459c7d3c244efc6741dd0c764a8f88290a80d08039ca9ebfef23c8
|
|
BLAKE2b-256 checksum How to use checksums |
cfbb1d277d65d0ba9b27305edb3c71789c92cbad4a5075394c4cb7e508c0f751
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for kolors 0.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.