#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    25
    Rep Power
    0

    Color Console Output


    Does any1 know how to produce colored console output wo/ using ncurses or similar?
  2. #2
  3. No Profile Picture
    Tattooed Python-Lovin' Freak-Boy
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2001
    Location
    orange county, CA
    Posts
    16
    Rep Power
    0
    i'm pretty sure you can use escape sequences to do what you're wanting to do, never done it though.
  4. #3
  5. Wacky hack
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2001
    Location
    London, England
    Posts
    513
    Rep Power
    14
    There's a module packaged with Gentoo that lets you do it (which I mistakenly put into my app QuickRip thinking it was a standard lib!). I've attached it to this message. You can then just do:

    Code:
    import output
    
    print output.green("hello")
    Attached Files
  6. #4
  7. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69

    Windows


    Just messing around with output.py, have to point out that this will not work on windows simply because linux and windows consoles work differently, instead of printing a new color in windows it simple prints the color code followed by the content and the color codes escape sequence, which in linux would cause colored output.

    I dont know if it is possible to get colored output on windows, but if somone takes the time to write the modules i'm sure that this would be included in the Python standard lib!

    glad that you found it telex,
    Mark.
    Last edited by netytan; July 10th, 2003 at 07:53 PM.

IMN logo majestic logo threadwatch logo seochat tools logo