Colored texts 'n' background?

Started by
2 comments, last by Perost 19 years, 3 months ago
Okay im making a simple irc bot in C. Im running slackware 10. Now, i want the backround to be black, and the incoming info (that the server sends) to be blue, and the messeges the bot sends to be red (or something similar) Is that possible? The first thing that came to my mind was ncurses, but is it hard to do that with ncurses? The second thing i thought about was the 'built in' color codes with linux (vt100). printf("\\033[32m I'm green text"); But then i cant do the backround black, right? Anyways, if you could hook me up with those color codes, or maybe a simple ncurses tutorial that learns to to color things, that would be great! thank you Best regards, Max!
Advertisement
I'm not 100% sure if this is on the right track, but have you tried using the telnet escapes?
%c[1;37m where %c is characted #27(yeah, decimal)
That one should give you a bright white color, and this one: %c[0;31m should give you a dark-red color. If it works, go between them to figure out the different colors.
And, in telnet atleast, you can set the background color aswell.
[google] knows all.
I've tried using ncurses long ago, and I'd say go with it. It's quite easy to use, and you can change the color on background and text like you want. As Zahlman said, try google for a ncurses tutorial.

This topic is closed to new replies.

Advertisement