码迷,mamicode.com
首页 > 编程语言 > 详细

c++之改变终端输出的颜色

时间:2018-12-24 23:42:20      阅读:964      评论:0      收藏:0      [点我收藏+]

标签:gre   end   std   tput   pre   yellow   put   text   esc   

c++之改变终端输出的颜色

#include <iostream>

int main(int argc, char** argv)
{
  std::cout << "\033[0;30m This is black color text ! \033[0m" << std::endl;
  std::cout << "\033[0;31m This is red color text ! \033[0m" << std::endl;
  std::cout << "\033[0;32m This is green color text ! \033[0m" << std::endl;
  std::cout << "\033[0;33m This is orang color text ! \033[0m" << std::endl;
  std::cout << "\033[0;34m This is blue color text ! \033[0m" << std::endl;
  std::cout << "\033[0;35m This is purple color text ! \033[0m" << std::endl;
  std::cout << "\033[0;36m This is cyan color text ! \033[0m" << std::endl;
  std::cout << "\033[0;37m This is light gray color text ! \033[0m" << std::endl;

  return 0;
}
颜色 code 颜色 code
black 0;30 dark gray 1;30
red 0;31 light red 1;31
green 0;32 light green 1;32
brown/orange 0;33 yellow 1;33
blue 0;34 light blue 1;34
purple 0;35 light purple 1;35
cyan 0;36 light cyan 1;36
light vray 0;37 whilte 1;37

c++之改变终端输出的颜色

标签:gre   end   std   tput   pre   yellow   put   text   esc   

原文地址:https://www.cnblogs.com/ChrisCoder/p/10171331.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!