https://github.com/henryboisdequin/cologger
https://github.com/henryboisdequin/cologger
cologger color pip pip-package python
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/henryboisdequin/cologger
- Owner: henryboisdequin
- License: mit
- Created: 2021-01-12T09:57:35.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-13T12:28:49.000Z (over 5 years ago)
- Last Synced: 2026-01-06T04:38:54.361Z (6 months ago)
- Topics: cologger, color, pip, pip-package, python
- Language: Python
- Homepage: https://pypi.org/project/cologger/
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cologger
[](https://pypi.python.org/pypi/cologger/)
[](https://opensource.org/licenses/MIT)
Make your endless print statements with color, different formats, and more!
## Installation
Windows:
```
pip install cologger
```
Mac or Linux:
```
pip3 install cologger
```
## Usage
Cologger allows for colors, background colors, and formats. Let's have a look at a basic example:
```python
from cologger import Cologger
cologger = Cologger()
cologger.set_color("red")
cologger.colog("Hello Cologger!")
```
This code will print out a red "Hello Cologger!" message. To set the background we use the `set_bg` method.
```python
from cologger import Cologger
cologger = Cologger()
cologger.set_color("red")
cologger.set_bg("white")
cologger.colog("Hello Cologger!")
```
To set the format of a string, use the `set_fmt` method.
```python
from cologger import Cologger
cologger = Cologger()
cologger.set_color("red")
cologger.set_bg("white")
cologger.set_fmt("bold")
cologger.colog("Hello Cologger!")
```
What separates Cologger from other Python color logging libraries is custom colors and backgrounds. Cologger allows for you to add a custom RGB color into the `set_color` and `set_bg` methods. Let's have a look at an example.
Custom Color:
```python
from cologger import Cologger
cologger = Cologger()
cologger.set_color("custom", [255, 0, 0]) # red rgb code
cologger.colog("Hello Cologger!")
```
Custom Background:
```python
from cologger import Cologger
cologger = Cologger()
cologger.set_bg("custom", [255, 255, 255]) # white rgb code
cologger.colog("Hello Cologger!")
```
Here are all the supported colors for the `set_color` method:
- "black"
- "red"
- "green"
- "yellow"
- "blue"
- "violet"
- "cyan"
- "white"
Here are all the supported colors for the `set_bg` method:
- "black"
- "red"
- "green"
- "yellow"
- "blue"
- "violet"
- "cyan"
- "white"
Here are all the supported formats for the `set_fmt` method:
- "bold"
- "italic"
- "underline"
- "selected"
- "strikethrough"