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

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

猜你喜欢

转载自www.cnblogs.com/ChrisCoder/p/10171331.html
今日推荐