-3

how to make text colored in c lang? The example is given in the image included.

enter image description here

Scooter
  • 6,802
  • 8
  • 41
  • 64
  • Possible duplicate of [C color text in terminal applications in windows](https://stackoverflow.com/questions/9203362/c-color-text-in-terminal-applications-in-windows) – JJJ May 26 '17 at 13:55
  • Avoid links. Display your image directly and show us what you have done so far – Badda May 26 '17 at 13:55
  • 1
    Are you on linux, windows or mac? Do you need a library? – Erik W May 26 '17 at 13:55
  • [some code](https://github.com/Zirias/pocas/blob/master/src/lib/core/textcolor_win32.c) -- just to get an idea what one COULD do. –  May 26 '17 at 13:58
  • @Badda [new users can only link images](https://meta.stackexchange.com/a/267491/208223). if you would have prefered an embeded image, you can suggest and edit to the question. Certainly OP should show what he has tried. Jivtesh Chahal see [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). You can [edit](https://stackoverflow.com/posts/44203371/edit) your question. – Theraot May 26 '17 at 14:08

1 Answers1

2

This may be realised via ANSI escape sequences, although the effect depends on the terminal application used. For example to change the text to red use:

puts("\033[31m");

For further information visit Wikipedia, which has decent reference for all codes.

qwertz
  • 14,614
  • 10
  • 34
  • 46