Re: How to print colored text to a linux terminal?
From: _at_'>o2.pl (_at_')
Date: 06/03/04
- Previous message: Måns Rullgård: "Re: Http Client Side Programming --- Any Libraries Avl."
- In reply to: Jan Panteltje: "Re: How to print colored text to a linux terminal?"
- Next in thread: Floyd L. Davidson: "Re: How to print colored text to a linux terminal?"
- Reply: Floyd L. Davidson: "Re: How to print colored text to a linux terminal?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 03 Jun 2004 13:53:09 +0200
> On a sunny day (Wed, 02 Jun 2004 19:55:55 +0000) it happened seesawman@163.com
> wrote in <40BE30CB.5692A265@163.com>:
>
>
>>Could anyone tell me how i can print colored text to a linux text-mode
>>terminal, just like ls command does.
>
> This makes use of the ANSI sequences
>
> Try this for example:
> char *text;
> int color;
> printf("\33[01;%dm%s\33[00m", color, text);/* \33 is escape */
>
> For the colors do some searching in www.google.com perhaps.
> JP
It will work, but it is better to use terminfo or termcap database
rather than escape codes. It will problems on other terminals. Of course
for small programs it isn't so important.
- Previous message: Måns Rullgård: "Re: Http Client Side Programming --- Any Libraries Avl."
- In reply to: Jan Panteltje: "Re: How to print colored text to a linux terminal?"
- Next in thread: Floyd L. Davidson: "Re: How to print colored text to a linux terminal?"
- Reply: Floyd L. Davidson: "Re: How to print colored text to a linux terminal?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|