Make your output sparkle, without long repetitive code
Project description
# Dazzle ✨
*Make your output sparkle, without long repetitive code*
Who doesn't love color, I know I do. However I don't like any color libs, they can take up so much column space, and
can end up being repetitive, leading to functions such as
```py
def announcement(title: str, desc: str):
print(colorlib.BLUE + "Announcement: " + title + colorlib.WHITE + "\n\n" + desc)
```
I actually have nothing against these functions, but they got me thinking. If I'm always going to end up making
functions, let's cut to the chase.
```py
from dazzle import Fore, INP
announce = Fore.BLUE + "Announcement: " + INP + Fore.WHITE + "\n\n" + INP
announce("Hello World", "Fizz Buzz")
```
Each of these methods would result in the same thing. Another issue with color libs, is that they can be a pain to
implement later down the road. Dazzle has you covered here too.
```py
with Back.BLUE + INP + " " + Fore.RED + " " + INP:
print("John:", "Howdy Mary")
print("Mary:", "Howdy John")
```
Dazzle will override the print function, so that it will add the colors provided in the with statement. Keep in mind
that any excess input will be ignored.
## Pitfalls
When you call a color chain, you pass `write=False` in so that it doesn't print the result. If write is True, it won't
output anything. If False it will output that string.
**Don't**
* Start it with a normal string, use `t(<string>)` if you need to do that.
* Use with statement with inconsistent print functions.
* Wrap it with `()`. It should still work, but their's no need.
* Use *repr* when requiring an input.
* Be stupid.
These were the docs, this is a very small and simple library.
[here you'll find a list of colors](https://github.com/tartley/colorama/blob/master/colorama/ansi.py#L49) that are
available. Dazzle covers Fore, Back, Style and Cursor, all as you'd expect. Thanks for using dazzle! ✨
*Make your output sparkle, without long repetitive code*
Who doesn't love color, I know I do. However I don't like any color libs, they can take up so much column space, and
can end up being repetitive, leading to functions such as
```py
def announcement(title: str, desc: str):
print(colorlib.BLUE + "Announcement: " + title + colorlib.WHITE + "\n\n" + desc)
```
I actually have nothing against these functions, but they got me thinking. If I'm always going to end up making
functions, let's cut to the chase.
```py
from dazzle import Fore, INP
announce = Fore.BLUE + "Announcement: " + INP + Fore.WHITE + "\n\n" + INP
announce("Hello World", "Fizz Buzz")
```
Each of these methods would result in the same thing. Another issue with color libs, is that they can be a pain to
implement later down the road. Dazzle has you covered here too.
```py
with Back.BLUE + INP + " " + Fore.RED + " " + INP:
print("John:", "Howdy Mary")
print("Mary:", "Howdy John")
```
Dazzle will override the print function, so that it will add the colors provided in the with statement. Keep in mind
that any excess input will be ignored.
## Pitfalls
When you call a color chain, you pass `write=False` in so that it doesn't print the result. If write is True, it won't
output anything. If False it will output that string.
**Don't**
* Start it with a normal string, use `t(<string>)` if you need to do that.
* Use with statement with inconsistent print functions.
* Wrap it with `()`. It should still work, but their's no need.
* Use *repr* when requiring an input.
* Be stupid.
These were the docs, this is a very small and simple library.
[here you'll find a list of colors](https://github.com/tartley/colorama/blob/master/colorama/ansi.py#L49) that are
available. Dazzle covers Fore, Back, Style and Cursor, all as you'd expect. Thanks for using dazzle! ✨
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dazzle-1.0.1.tar.gz
(4.6 kB
view details)
File details
Details for the file dazzle-1.0.1.tar.gz
.
File metadata
- Download URL: dazzle-1.0.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac4340fdda3725deb305d2304126018e84223b5e82708a288a1d8c7a4c547f41 |
|
MD5 | 4512660016df3a038217c33b96be5f1e |
|
BLAKE2b-256 | 121fb76bd73ab6c98297c79c38669cdb28814d1f0208a888c4d3b602020f9038 |