https://github.com/stephen-bunn/chalky
Simple ANSI terminal text coloring
https://github.com/stephen-bunn/chalky
chalk color terminal
Last synced: 6 months ago
JSON representation
Simple ANSI terminal text coloring
- Host: GitHub
- URL: https://github.com/stephen-bunn/chalky
- Owner: stephen-bunn
- License: isc
- Created: 2020-12-12T07:16:13.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-19T17:12:13.000Z (over 5 years ago)
- Last Synced: 2024-12-30T19:46:52.765Z (over 1 year ago)
- Topics: chalk, color, terminal
- Language: Python
- Homepage:
- Size: 2.27 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
Awesome Lists containing this project
README

[](https://pypi.org/project/chalky/)
[](https://github.com/stephen-bunn/chalky)
[](https://chalky.readthedocs.io/)
[](https://codecov.io/gh/stephen-bunn/chalky)
[](https://github.com/ambv/black)
> Simple ANSI terminal text coloring
Yet another terminal text coloring library…
Why? Because, I like certain things and I hate certain things about the currently
available solutions.
This here is my attempt to build an interface for simply applying ANSI escape sequences
to strings that I enjoy and can update at my own free will.
That is it, there is nothing new or interesting that this packages adds.
Thanks 🎉
For more interesting details, please visit the
[documentation](https://chalky.readthedocs.io/).
## Style Composition
```python
from chalky import sty, fg
my_style = sty.bold & fg.red
print(my_style | "This is red on black")
print(my_style.reverse | "This is black on red")
```

## Style Chaining
```python
from chalky import chain
print(chain.bold.green | "I'm bold green text")
print(chain.white.bg.red.italic | "I'm italic white text on a red background")
```

## Truecolor
```python
from chalky import rgb, sty, hex
print(rgb(23, 255, 122) & sty.italic | "Truecolor as well")
print(sty.bold & hex("#ff02ff") | "More and more colors")
```

## Disable Colors
```python
from chalky import configure, fg
print(fg.red | "I am red text")
configure(disable=True)
print(fg.red | "I am NOT red text")
```
