text: #pragma once
  
  #include <iostream>
  #define NOMINMAX
  #define WIN32_LEAN_AND_MEAN
  #include <windows.h>
  
  
  /*
  USAGE:
  
  std::cout << green << "This text is written in green"
            << white << std::endl;
  std::cout << color(FOREGROUND_RED|FOREGROUND_GREEN)
            << "This text has a really exiting color !"
            << white << std::endl;
  
  std::cout << color(colors::DARKMAGENTA);
  std::cout << "This is written in darkmagenta." << "\n"; 
  */
  
  
  #define APP_COLOR  color(FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
  #define APP_SUCCESS_COLOR  color(FOREGROUND_GREEN | FOREGROUND_INTENSITY)
  #define APP_ERROR_COLOR  color(FOREGROUND_RED | FOREGROUND_INTENSITY)
  
  #define DEFAULT_USER_COLOR color(FOREGROUND_BLUE | FOREGROUND_RED | FOREGROUND_INTENSITY)
  #define DEFAULT_INET_USER_COLOR color(FOREGROUND_GREEN | FOREGROUND_BLUE)
  
  
  namespace colors {
      enum {
          BLACK = 0,
          DARKBLUE = FOREGROUND_BLUE,
          DARKGREEN = FOREGROUND_GREEN,
          DARKCYAN = FOREGROUND_GREEN | FOREGROUND_BLUE,
          DARKRED = FOREGROUND_RED,
          DARKMAGENTA = FOREGROUND_RED | FOREGROUND_BLUE,
          DARKYELLOW = FOREGROUND_RED | FOREGROUND_GREEN,
          DARKGRAY = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
          GRAY = FOREGROUND_INTENSITY,
          BLUE = FOREGROUND_INTENSITY | FOREGROUND_BLUE,
          GREEN = FOREGROUND_INTENSITY | FOREGROUND_GREEN,
          CYAN = FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_BLUE,
          RED = FOREGROUND_INTENSITY | FOREGROUND_RED,
          MAGENTA = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE,
          YELLOW = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN,
          WHITE = FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE,
      };
  }
  
  
  inline std::ostream& blue(std::ostream& s)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout, FOREGROUND_BLUE
          | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
      return s;
  }
  
  inline std::ostream& red(std::ostream& s)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout,
          FOREGROUND_RED | FOREGROUND_INTENSITY);
      return s;
  }
  
  inline std::ostream& green(std::ostream& s)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout,
          FOREGROUND_GREEN | FOREGROUND_INTENSITY);
      return s;
  }
  
  inline std::ostream& yellow(std::ostream& s)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout,
          FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY);
      return s;
  }
  
  inline std::ostream& white(std::ostream& s)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout,
          FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
      return s;
  }
  
  struct color {
      color(WORD attribute) :m_color(attribute) {};
      WORD m_color;
  };
  
  template <class _Elem, class _Traits>
  std::basic_ostream<_Elem, _Traits>&
  operator<<(std::basic_ostream<_Elem, _Traits>& i, const color& c)
  {
      HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
      SetConsoleTextAttribute(hStdout, c.m_color);
      return i;
  }
  
  