c++之改變終端輸出的顏色
阿新 • • 發佈:2018-12-24
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 |