Console.ForegroundColor method in C#

In this article, I will explain you about Console.ForegroundColor method in C#.
  • 7577

Introduction

Console applications are run on a black and white screen. We can change the background and foreground color of a console application. This makes program easier to use and more expressive. Console.ForegroundColor method is used to change the foreground color of  text on console window.

Example

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace ConsoleApplication11

{

    class Program

    {

        static void Main()

        {

            Console.ForegroundColor = ConsoleColor.Red;

            Console.WriteLine("*Uma*****************");

            Console.WriteLine(" *is ");

            Console.WriteLine("  *a");

            Console.WriteLine("   *very");

            Console.WriteLine("    *beautiful");

            Console.WriteLine("     Girl*********************");

            Console.ReadLine();

 

        }

    }

}

 

The output of above program

 Clipboard216.jpg

© 2020 DotNetHeaven. All rights reserved.