Giter Site home page Giter Site logo

hues's Introduction

Hues

This is the 90s and your terminal can display 16 glorious colors. Your Python scripts deserve the same 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!

Preview

Build Status Test Coverage PyPI

Quickstart

Go, grab the latest version from PIP. Run:

pip install hues

Then, in your scripts, you can do this:

>>> import hues
>>> hues.log('Mission', 42)
>>> hues.info('Finding', 42)
>>> hues.error(41, 'is not', 42)
>>> hues.warn('We are distracted...')
>>> hues.info('Found', 24)
>>> hues.success('Close enough.')

Example

whoa!

Configuration

You can add a .hues.yml file in your projects, or your home directory, overriding the defaults. The configuration files are searched and loaded in this order:

  • Packaged configuration
  • User home directory
  • Current directory and all the parent directories

Check out the default configuration here. Currently there's a powerline theme shipped with the package which you can enable by updating theme value in configuration.

Creating your own prompts

hues makes it easy to create your own custom prompt formats with a Hue String. Hue string is a thin wrapper around Python strings adding a chainable syntax that's a joy to use!

>>> import hues
>>> print(hues.huestr(' 42 ').white.bg_blue.bold.colorized)

It does exactly what it says:

Example

The Hue string chained attributes use a deterministic pushdown automata for optimizing the attribute access, so the ANSI escaped strings are always optimal.

Colors

All 16 glorious ANSI colors are available for both background and foreground. Assorted text styles such as bold, italics and underline are also available. Too many colors? Worry not fam, go to town with reset attribute.

Todo

  • More Documentation.
  • Unicorns required.

Please contribute by opening issues, suggestions and patches.

If you like hues or use it in your project, I'd love to hear about it! Shout at me on tumblr or send me an email.

Back in my days, we didn't even have colors!

hues's People

Contributors

prashnts avatar 3onyc avatar

Watchers

James Cloos avatar Lucas Infante avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.