Skip to content

Commit

Permalink
Added a local config and example
Browse files Browse the repository at this point in the history
  • Loading branch information
prashnts committed Oct 2, 2016
1 parent 3258d9f commit dfcdc3d
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .hues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
labels:
info: INFO
warn: WARN
error: ERR
success: S
hues:
time: blue
options:
theme: powerline
29 changes: 16 additions & 13 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Hues
This is the 90s and your terminal can display _16_ glorious colors. Your Python scripts deserve the some color love. `Hues` makes printing to console in color easy. Just grab the package from `PIP`, and your monochromatic days will be a thing of past!

This is the 90s and your terminal can display _16_ glorious colors.
Your Python scripts deserve the some color love. `Hues` makes printing
to console in color easy.

Just grab the package from `PIP`, and your monochromatic days will be a
thing of past!

## Quickstart

Expand All @@ -15,13 +10,25 @@ Go, grab the latest version from PIP. Run:
pip install hues
```

Then, in your scripts, do this:
Then, in your scripts you can do this:

```python
>>> from hues import hue
>>> print(hue('unicorns!').bright_cyan.bold)
import hues

hues.info('Destroying the universe')

try:
destroyinator()
except IncomingPerryThePlatipus:
hues.error('Curse you Perry the Platipus!')
else:
hues.success('Destroyed the universe.')
```


## Configuration

[TODO]

_whoa!_

Expand All @@ -41,9 +48,5 @@ Each `hue` string is self closing, so you can't accidentally color your whole te
All 16 glorious ANSI colors are available for both background and foreground. Assorted text styles such as **`bold`**, _`italics`_ and <u>`underline`</u> are also available. Too many colors? Worry not fam, go to town with `reset` attribute.


## Todo
- [ ] Expand this readme.
- [ ] Add screenshots!
- [ ] Unicorns required.

> Back in my days, we didn't even have colors!
30 changes: 30 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import hues
import random
import time


class ThisPlanetIsProtected(Exception):
pass


def destroy_planet(planet):
if planet == 'Earth':
raise ThisPlanetIsProtected
return random.randint(0, 100) < 42

if __name__ == '__main__':
hues.info('Destroying the planets. Please wait.')

for planet in ('Murcury', 'Venus', 'Earth', 'Mars', 'Uranus',):
try:
success = destroy_planet(planet)
except ThisPlanetIsProtected:
hues.warn('The Doctor saved', planet)
else:
if success:
hues.success('Destroyed', planet)
else:
hues.error('Could not destroy', planet)
time.sleep(.5)

hues.info('So long, and thanks for all the fish.')

0 comments on commit dfcdc3d

Please sign in to comment.