• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Colors in a console

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to make a BBS door game, and I need to make the text display localy as well as through the existing bbs connection.
My question applys to displaying text locally (in a console, not in a gui). How do I change the color of the text that is displayed? Also, how do I change the location on the screen that the text is displayed to?
I have done some searching(google.com), and so far the only examples I can find are in a gui app.
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This can be done in DOS/Windows using ANSI.SYS. I'm sure you'll find plenty to wade through in google about the escape sequences to specify colors, etc. Since config.sys is not so widely used today, it may not be so obvious how to install it. But I did spot this: http://www.nthelp.com/40/ansiNT.htm
 
Joshua Austin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so there is no real way to have it automaticly do color without the end user having to do all this stuff to load ansi.sys?
 
John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There only thing I recall for DOS windows. The APIs I recall for supporting color in DOS windows required ANSI.SYS, I think. (Installing it on DOS or Win95 systems was routine. But I don't know about anything more recent.) Of course, if your console is some terminal emulator instead of a DOS window, it probably supports color escape directly. See the program documentation. You can buy terminal emulators. I suspect there are some good free ones as well.
 
Joshua Austin
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am just printing to whatever the standard console is (using System.out.print) . Weather the console supports ANSI codes depends on what the end user is using to run the program. Its kind of hard to make an installer that does ansi.sys, considering the door game (written in java) will be run under linux, and other OSs' as well, which probably dont use ansi.sys, and may or may not allow ANSI codes.
[ September 09, 2002: Message edited by: Joshua Austin ]
[ September 09, 2002: Message edited by: Joshua Austin ]
 
John Dale
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I recall, the ANSI codes supported by ANSI.SYS are supported by the terminal emulators often used for accessing Unix systems. Perhaps some Unix/Linux user can tell you whether their consoles are typically set up this way.
But, as you observe, it is a pain now, at least on the windows side. It was even a pain back when it was routine, and worse now that it isn't commonly used, at least in the Windows world.
However, among the last widespread consumer (as opposed to business) users of this stuff may be (or have been) the BBS community, so you may find your BBS users are already set up for this. Perhaps you should try to find a older BBS techie. Maybe there are BBS's about BBS technology. :-)
 
Let's go to the waterfront with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic