https://github.com/coghost/sgr-ansi
SGR ANSI colorful terminal
https://github.com/coghost/sgr-ansi
Last synced: about 1 month ago
JSON representation
SGR ANSI colorful terminal
- Host: GitHub
- URL: https://github.com/coghost/sgr-ansi
- Owner: coghost
- License: gpl-3.0
- Created: 2020-04-05T08:12:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-18T02:44:29.000Z (almost 6 years ago)
- Last Synced: 2025-01-02T21:19:46.527Z (over 1 year ago)
- Language: Python
- Size: 748 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sgr-ansi
awesome SGR ANSI colorful text interface in terminal
> full supported in python3.7+, macosx
## awesome colorful text



## install
```shell
pip install sgr-ansi
```
## usage
Beware of two rules:
- styles require **alphabet order**
- styles go before colors
about styles, you can use as many as possible, but colors only the last two will take effect
so like `BDISUkrgybmcw`, all `BDISU` will take effect, but for colors only `cw: cyan on white` will take effect
### styles/colors supported
> styles
B: bold, D: dimmed, I: italic, S: strike_through, U: underlined
> colors
k: black, r: red, g: green, y: yellow b: blue, m: magenta, c: cyan, w: white
```python
import sgr_ansi as echo
echo.BIg()
echo.BIg('I love you 3 thousand times')
```
### chained call
```python
from sgr_ansi import Chain
Chain().BIy('Yep,').BIUb(
'How do you like this?'
).Bm('\n\t[✔]').BUg('1.').Bg('Y: yes.').Bm('\n\t[✘]').BUr('2.').Br('N: not.').show()
```

## run demo
> just run `sgransi` to check all available styles
```sh
# after installed sgr_ansi, cli sgransi is available
sgransi -h
```