/***************************************************************************//**
 *
 * \file rosa/support/terminal_colors.h
 *
 * \author David Juhasz (david.juhasz@tuwien.ac.at)
 *
 * \date 2017
 *
 * \brief Facility for printing colorized text to terminals supporting it.
 *
 ******************************************************************************/

#ifndef ROSA_SUPPORT_TERMINAL_COLORS_H
#define ROSA_SUPPORT_TERMINAL_COLORS_H

#include <ostream>

namespace rosa {

/// Encloses entities related to terminal I/O.
namespace terminal {

/// Text colors for colorizable terminals.
enum class Color {
  Default,
  Black,
  Red,
  Green,
  Yellow,
  Blue,
  Magenta,
  Cyan,
  Lightgrey,
  Darkgrey,
  Lightred,
  Lightgreen,
  Lightyellow,
  Lightblue,
  LightMagenta,
  Lightcyan,
  White,
  NumColors ///< Number of `rosa::terminal::Color` values
};

/// Handles `rosa::terminal::Color` values sent to output streams.
///
/// The operator sends terminal commands  through `os` to the
/// associated terminal to change text color to `color`.
///
/// \note If `os` is not a terminal output, the terminal commands simply appear
///       as text in the stream.
///
/// \param [in,out] os `ostream` to apply `color` to
/// \param color `Color` to apply for `os`
///
/// \pre `color` is valid:\code
/// color != Color::NumColors
/// \endcoed
std::ostream &operator<<(std::ostream &os, const Color color);

} // End namespace terminal
} // End namespace rosa

#endif // ROSA_SUPPORT_TERMINAL_COLORS_H

