首页 > 技术文章 > C# 控制台应用程序输出颜色字体

marblemm 2017-06-27 13:42 原文

最佳解决方案的代码:

 

1 static void Main(string[] args)
2 {
3 Console.ForegroundColor = ConsoleColor.Green;
4 Console.WriteLine("Hello, color text!");
5 Console.ForegroundColor = ConsoleColor.Red;
6 Console.WriteLine("Hello, color text!");
7 Console.ReadKey();
8 }

 

效果如图:

 

推荐阅读