Giter Site home page Giter Site logo

consolor's Introduction

consolor

https://travis-ci.org/paetzke/consolor.png?branch=master https://coveralls.io/repos/paetzke/consolor/badge.png?branch=master https://pypip.in/v/consolor/badge.png

Consolor provides highlighting functions for terminals.

It comes with there 3 functions:

get_line
Returns a string with the given formatting.
print_line
Prints a string with the given formatting.
update_line
Overwrites the output of the current line and prints s on the same line without a new line.

All these functions accept the following formatting parameters:

  • bold: bool, default False
  • underline: bool, default False
  • blinking: bool, default False
  • color: str, default None
  • bgcolor: str, default None

https://paetzke.me/static/images/consolor.png

Some examples:

import consolor

consolor.print_line('light green', color=consolor.Color.LightGreen)
consolor.print_line('underline', underline=True)
consolor.print_line('green bg', bgcolor=consolor.BgColor.Green)
consolor.update_line('0%')
consolor.update_line('100%')
print()

For more colors and background colors see consolor.Color and consolor.BgColor.

You can also use it in builtin print():

import consolor

print(consolor.Color.Red, 'Red')
print('Red two')
print(consolor.Color.Reset, end='') # You have to handle resetting your self.
print('Not Red')

print(consolor.BgColor.Red, 'Red')
print('Red two', consolor.BgColor.Reset)
print('None')

To install consolor use pip.

pip install consolor

Bugs and improvements

Feel free to open tickets or send pull requests with improvements. These contributors have done so.

Links

Copyright

Copyright (c) 2013-2015 Friedrich Pätzke. See LICENSE for further details.

See you. Friedrich.

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.