Jump to content

Escape character ansi colors and ncurses

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
tobs

tobs

    Newbie

  • Members
  • Pip
  • 3 posts
Hello,

I am currently devloping a linux console-based ftp client using ncurses. Since some ftpd's like glftpd have the ability to add color to its output using ansi colors (escape characters) i just want to ask if someone knows of a more or less simple way to display them in the right way. I've googled a lot but found nothing appropriate.

Thanks for your help,

- T.

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I would suggest looking at the glftpd's source code.

#3
tobs

tobs

    Newbie

  • Members
  • Pip
  • 3 posts

Jordan said:

I would suggest looking at the glftpd's source code.

I'd do so, but sadly it's closed source.

#4
Guest_Jordan_*

Guest_Jordan_*
  • Guests
Found these, hope it helps:

\033[22;30m - black
\033[22;31m - red
\033[22;32m - green
\033[22;33m - brown
\033[22;34m - blue
\033[22;35m - magenta
\033[22;36m - cyan
\033[22;37m - gray
\033[01;30m - dark gray
\033[01;31m - light red
\033[01;32m - light green
\033[01;33m - yellow
\033[01;34m - light blue
\033[01;35m - light magenta
\033[01;36m - light cyan
\033[01;37m - white

Print in Red:
printf("\033[22;31mHello, world!");


#5
Guest_Jordan_*

Guest_Jordan_*
  • Guests
This may be some help also: Linux Console Colors & Other Tricks

#6
chax

chax

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts

Jordan said:

Found these, hope it helps:

\033[22;30m - black
\033[22;31m - red
\033[22;32m - green
\033[22;33m - brown
\033[22;34m - blue
\033[22;35m - magenta
\033[22;36m - cyan
\033[22;37m - gray
\033[01;30m - dark gray
\033[01;31m - light red
\033[01;32m - light green
\033[01;33m - yellow
\033[01;34m - light blue
\033[01;35m - light magenta
\033[01;36m - light cyan
\033[01;37m - white

Print in Red:

printf("\033[22;31mHello, world!");


what about \e instead of \033:confused:

#7
tobs

tobs

    Newbie

  • Members
  • Pip
  • 3 posts
well, thanks for your help so far, but the problem is you can't use escape sequences in ncurses ...