Print Coloured Text to Console in C++

前端 未结 4 1447
眼角桃花
眼角桃花 2020-12-31 21:38

I would like to write a Console class that can output coloured text to the console.

So I can do something like (basically a wrapper for printf):

Cons         


        
4条回答
  •  伪装坚强ぢ
    2020-12-31 22:12

    use these functions

    enum c_color{BLACK=30,RED=31,GREEN=32,YELLOW=33,BLUE=34,MAGENTA=35,CYAN=36,WHITE=37};
    enum c_decoration{NORMAL=0,BOLD=1,FAINT=2,ITALIC=3,UNDERLINE=4,RIVERCED=26,FRAMED=51};
    void pr(const string str,c_color color,c_decoration decoration=c_decoration::NORMAL){
      cout<<"\033["<

提交回复
热议问题