Saturday, 21 September 2013

Console Application : Console Color

We Can Give Colors To Console Text.
This Is Very Small And Simple Tutorial.

You Can Give Foreground Color Using  "Console.ForegroundColor = ConsoleColor.Green;" this code.
And Background Color Using "Console.BackgroundColor = ConsoleColor.Blue;"
We Can Set Title To Console Using "Console.Title = "Custom Console Title";".

1. Create New Console Application Program Name It As CusomConsole.
2. Now Replace Your Program.cs with Below Code.

Program.cs


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CustomConsole
{
    class Program
    {
        static void Main(string[] args)
        {             
            Console.ForegroundColor = ConsoleColor.Green;
            Console.BackgroundColor = ConsoleColor.Red;
            Console.Title = "Custom Console Title";
            Console.WriteLine("This Is Coloured Text");
            Console.ReadLine();


        }
    }
}


3. Now Compile And Run Your Application.
You Will Have Titled And Color Text As Output.

My OutPut Is Given Below.



All The Best :)


No comments:

Post a Comment