This is the simple C# program to change the color of text in console. The beginner programmers can make their output of the program funny and interesting with this code.
Source Code
using System;
using System.Collections.Generic;
using System.Text;
namespace assad
{
class sortArrays
{
static void Main(string[] args)
{
welcomeScrean();
if (Console.BackgroundColor == ConsoleColor.Black)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Color is Red");
Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine("Color is Magenta");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("Color is Gray");
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("Color is DarkYellow");
Console.ForegroundColor = ConsoleColor.DarkCyan;
Console.WriteLine("Color is DarkCyan");
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("Color is Blue");
}
Console.ReadKey();
}
private static void welcomeScrean()
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write("\t*******************************************************" + "\n"
+ "\t*******************************************************" + "\n"
+ "\t** Change Console Color **" + "\n"
+ "\t** Program **" + "\n"
+ "\t*******************************************************" + "\n"
+ "\t*******************************************************\n\n\n\n");
}
}
}
0 comments:
Post a Comment