Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xy3/print-color
A simple Python wrapper to print color messages in the terminal
https://github.com/xy3/print-color
colorization pip pypi-package python python-colored-output python3 terminal terminal-colors
Last synced: 19 days ago
JSON representation
A simple Python wrapper to print color messages in the terminal
- Host: GitHub
- URL: https://github.com/xy3/print-color
- Owner: xy3
- License: apache-2.0
- Created: 2020-10-30T19:20:24.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-04T12:40:58.000Z (7 months ago)
- Last Synced: 2024-12-27T10:10:41.088Z (26 days ago)
- Topics: colorization, pip, pypi-package, python, python-colored-output, python3, terminal, terminal-colors
- Language: Python
- Homepage: https://pypi.org/project/print-color/
- Size: 45.9 KB
- Stars: 11
- Watchers: 2
- Forks: 6
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# print-color
[![test](https://github.com/xy3/print-color/actions/workflows/ci.yml/badge.svg)](https://github.com/xy3/print-color/actions/workflows/ci.yml) ![downloads](https://img.shields.io/pypi/dw/print-color)
```python3
from print_color import printprint("Hello world", tag='success', tag_color='green', color='white')
```Print Color is a minimalist approach to terminal color printing in Python. It is a wrapper around the `print()` function, and simply allows you to provide extra optional parameters such as:
- `tag`
- `tag_color` or `tag_colour`
- `tag_format`
- `color` or `colour`
- `background`
- `format`It aims to be a customizable logger for your applications, and makes formatting warnings, info messages and errors a breeze.
---
## Information
This project has no dependencies, apart from `pytest` for testing.
Check out this project on [PyPi here](https://pypi.org/project/print-color/).
Colors:
```text
purple
blue
green
yellow
red
magenta
cyan
white
black
```### Parameter values:
- `tag`
- any string
- `tag_color` or `tag_colour`
- color
- `color` or `colour`
- color
- `background`
- color
- `format`
- bold
- underline
- blink### Installing
```shell
pip3 install print-color
```### Requirements
- python 3.7^
### Usage
```python
from print_color import printprint("Hello world", tag='success', tag_color='green', color='white')
```![Success tag](https://i.imgur.com/qmeYTkR.png)
```python
print("Error detected", tag='failure', tag_color='red', color='magenta')
```![Error tag](https://i.imgur.com/dksa03u.png)
```python
print("Printing in color", color='green', format='underline', background='grey')
```![Printing in color is easy](https://i.imgur.com/3sUTi8z.png)
## Contributing
Feel free to add or improve this project :) Just create a pull request and explain the changes you propose.
Note that as this is a very simple project, feature requests should be kept minimal - things like more colors, formats etc would be ideal.## Credits
Built with [Python Poetry](https://python-poetry.org/).
### Contributors