GithubHelp home page GithubHelp logo

lskbr / colorconsole Goto Github PK

View Code? Open in Web Editor NEW
53.0 53.0 9.0 52 KB

Python comes with batteries included, but console applications have no color. This project brings a very simple interface to colored console output. It does not replace curses or more sophisticated libraries. If you just need to print colored text using the same API on Linux, Windows and Mac OS X, colorconsole can be a good option. It uses ctypes to access Windows console API routines and ANSI escape codes for xterm on Linux and Mac OS X.

License: Other

Python 100.00%

colorconsole's People

Contributors

lskbr avatar nilologikraft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colorconsole's Issues

Possible type-o in ansi.py?

Hi there,

first off excellent project, like it very much and definitely helps keeping my script's output tidy!

When stumbling through the code (version 0.7.2) I ended up in ansi.py, in reset_colors(), line 190.

Here it says:

def reset_colors(self):
    self.default_background()
    self.default_foreground
    self.reset()

shouldn't there be a "()" after "self.default_foreground" ?

Thanks!
Sebastian.

Crashes on 64 bit Windows using 64 bit Python

On 64 bit Windows using 32 bit Python (I suppose 32 bit Windows is ok too =)), everything works normally.

When using 64 bit Python in 64 bit Windows, it crashes on all operations, involving gotoXY, when calling WinAPI.

Error on windows python

I pip installed colorconsole using python 2.7.13 and managed to succesfully import it. However upon testing it I get the error, ctypes.ArgumentError: argument 4: <type 'exceptions.TypeError'>: wrong type.
The full traceback is

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\colorconsole\terminal.py", line 69, in test
    t.clear()
  File "C:\Python27\lib\site-packages\colorconsole\win.py", line 170, in clear
    sx, rp, byref(wr))
ctypes.ArgumentError: argument 4: <type 'exceptions.TypeError'>: wrong type

How can I prevent this?

error with color on linux Debian

for me on linux Debian, the color is

colorconsole.ansi.Terminal.colors_fg = {
         0: "30m", # BLACK
         1: "34m", # BLUE
         2: "32m", # GREEN
         3: "36m", # CYAN
         4: "31m", # RED
         5: "35m", # PURPLE
         6: "33m", # BROWN
         7: "37m", # LGREY
         8: "1;30m", # DGRAY
         9: "1;34m", # LBLUE
         10: "1;32m", # LGREEN
         11: "1;36m", # LCYAN
         12: "1;31m", # LRED
         13: "1;35m", # LPURPLE
         14: "1;33m", # YELLOW
         15: "1;37m" # WHITE
        }
colorconsole.ansi.Terminal.colors_bk = {
         0: "40m",
         1: "42m",
         2: "42m",
         3: "46m",
         4: "41m",
         5: "45m",
         6: "43m",
         7: "47m",
        }

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.