문자 출력을 할때 색은 어떻게 조정 하는지..

시안의 이미지

리눅스에서 간단한 문장을 출력 하는데 그 문장에

색을 넣고 싶으면 어떻게 하는지 알려 주시기 바랍니다 : )

sangheon의 이미지

man ncurses

--

Minimalist Programmer

ageldama의 이미지

단순히 안시코드를 쓰셔도 좋을듯하네요

http://www.bluesock.org/~willg/dev/ansi.html

Quote:

color and text formatting
ESC[#(;#)m there can be multiple text formatting sequence numbers separated by a ; and ending with an m where the # is of the following values:
attributes
0 normal display
1 bold
4 underline (mono only)
5 blink on
7 reverse video on
8 nondisplayed (invisible)
foreground colors
30 black
31 red
32 green
33 yellow
34 blue
35 magenta
36 cyan
37 white
background colors
40 black
41 red
42 green
43 yellow
44 blue
45 magenta
46 cyan
47 white

...

Green \e[0;32m

----
The future is here. It's just not widely distributed yet.
- William Gibson

시안의 이미지

제가 아직 매뉴얼 페이지만 보고 이해할수 있는 수준이 아니기 때문에

귀찮으시더라도 C언어로 간단하게 예제를 써 주시면 감사하겠습니다.

ageldama의 이미지

/* 이후의 출력은 검정바탕에 초록으로 */
printf("\e[0;32m");

----
The future is here. It's just not widely distributed yet.
- William Gibson