title: Using C/C++, how do you print to stdout in color, but only if the terminal supports it?
body: <p>I have a program that log things to <code>STDOUT</code>.</p>
  
  <p>Those log entries have an associated "log level" (debug, warning, information, and so on) and I'd like to give the user the ability to color this output, depending on the log level.</p>
  
  <p>What is the way of determining if <code>STDOUT</code> is attached to a terminal that is-color capable ?
  And how can I output my text with colors then ?</p>
  
  <p>I'm looking for a solution that involves only C or C++ calls. I guess <code>curses</code> (or <code>ncurses</code>) has something to ease this, but I'd like to avoid its use to keep my dependencies to a minimum.</p>