123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- #ifndef IVSTDCOLOROUT_H
- #define IVSTDCOLOROUT_H
- //#define RESET "\033[0m"
- //#define BLACK "\033[30m" /* Black */
- //#define RED "\033[31m" /* Red */
- //#define GREEN "\033[32m" /* Green */
- //#define YELLOW "\033[33m" /* Yellow */
- //#define BLUE "\033[34m" /* Blue */
- //#define MAGENTA "\033[35m" /* Magenta */
- //#define CYAN "\033[36m" /* Cyan */
- //#define WHITE "\033[37m" /* White */
- //#define BOLDBLACK "\033[1m\033[30m" /* Bold Black */
- //#define BOLDRED "\033[1m\033[31m" /* Bold Red */
- //#define BOLDGREEN "\033[1m\033[32m" /* Bold Green */
- //#define BOLDYELLOW "\033[1m\033[33m" /* Bold Yellow */
- //#define BOLDBLUE "\033[1m\033[34m" /* Bold Blue */
- //#define BOLDMAGENTA "\033[1m\033[35m" /* Bold Magenta */
- //#define BOLDCYAN "\033[1m\033[36m" /* Bold Cyan */
- //#define BOLDWHITE "\033[1m\033[37m" /* Bold White */
- namespace iv {
- enum STDCOLOR
- {
- STDCOLOR_DEFUALT = 1,
- STDCOLOR_BLACK = 2,
- STDCOLOR_RED = 3,
- STDCOLOR_GREEN = 4,
- STDCOLOR_YELLOW = 5,
- STDCOLOR_BLUE = 6,
- STDCOLOR_MAGENTA = 7,
- STDCOLOR_CYAN = 8,
- STDCOLOR_WHITE = 9,
- STDCOLOR_BOLDBLACK = 10,
- STDCOLOR_BOLDRED = 11,
- STDCOLOR_BOLDGREEN = 12,
- STDCOLOR_BOLDYELLOW = 13,
- STDCOLOR_BOLDBLUE = 14,
- STDCOLOR_BOLDMAGENTA = 15,
- STDCOLOR_BOLDCYAN = 16,
- STDCOLOR_BOLDWHITE = 17
- };
- }
- #include <iostream>
- inline void ivstdcolorout(std::string str,iv::STDCOLOR color = iv::STDCOLOR::STDCOLOR_DEFUALT)
- {
- if(color == iv::STDCOLOR::STDCOLOR_DEFUALT)
- {
- std::cout<<str<<std::endl;
- return;
- }
- switch (color) {
- case iv::STDCOLOR::STDCOLOR_DEFUALT:
- std::cout<<str<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BLACK:
- std::cout<<"\033[30m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_RED:
- std::cout<<"\033[31m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_GREEN:
- std::cout<<"\033[32m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_YELLOW:
- std::cout<<"\033[33m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BLUE:
- std::cout<<"\033[34m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_MAGENTA:
- std::cout<<"\033[35m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_CYAN:
- std::cout<<"\033[36m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_WHITE:
- std::cout<<"\033[37m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDBLACK:
- std::cout<<"\033[1m\033[30m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDRED:
- std::cout<<"\033[1m\033[31m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDGREEN:
- std::cout<<"\033[1m\033[32m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDYELLOW:
- std::cout<<"\033[1m\033[33m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDBLUE:
- std::cout<<"\033[1m\033[34m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDMAGENTA:
- std::cout<<"\033[1m\033[35m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDCYAN:
- std::cout<<"\033[1m\033[36m"<<str<<"\033[0m"<<std::endl;
- break;
- case iv::STDCOLOR::STDCOLOR_BOLDWHITE:
- std::cout<<"\033[1m\033[37m"<<str<<"\033[0m"<<std::endl;
- break;
- default:
- std::cout<<str<<std::endl;
- break;
- }
- }
- #endif // IVSTDCOLOROUT_H
|