aAaEDEADBDBXWCB| 69789ZCCW~BC 646466WB 957757VZ-

Console.` Rainbows, in all times and ages, have been seen as beautiful. In a console program, colors (like in a rainbow) can be used. These may be less beautiful—but perhaps more useful.`On a console,` text and background colors can be changed. This sometimes makes programs easier to use. Errors and alerts are more noticeable.`Example.` Console has many static methods and properties on it. To see them, type "Console" and press the period. IntelliSense will show you the possible methods. `We see BackgroundColor and ForegroundColor. These are properties, so we do not call them like methods.`We use ResetColor(), which is a method. Is resets all colors on the Console.`Static Method `static`Notes, above program.` The System namespace contains the Console class. In Main, the BackgroundColor property is set to ConsoleColor.Blue. ForegroundColor is set to ConsoleColor.White. `Property `property`The two lines, when they are printed, will both have blue backgrounds and white foregrounds.`We see the ResetColor method on Console being used. This sets the colors in your Console back to their defaults.`Example 2.` Writing an entire row of color in the Console may be helpful. It may make a good separator (like a line). Here we refactor the Console code into a separate method. `In that method, you can change the colors, pad the string, and reset the console.`PadRight: `For PadRight the parameter is the Console.WindowWidth minus one. This returns a string that will fill up the Console's width.`Console.WriteLine `console`If you do not subtract one with the PadRight method, it sometimes incorrectly wraps lines.`Example 3.` Here we see a program that displays all the backgrounds and foregrounds possible with the Console. It would be interesting to nest the loops and run though all combinations. `MSDN shows a similar program with more complexity. Always use all high-quality references that are available.`Console.BackgroundColor: MSDN `https://msdn.microsoft.com/en-us/library/system.console.backgroundcolor.aspx`Notes, above program.` The program will output a list of ConsoleColor values. If you choose white on blue, you may evoke memories of the BSOD (Blue Screen of Death).`Padding.` Colors are not always the best formatting option. Try focusing on the structure of your output, with padding. We can make columns of text. `PadRight, PadLeft `padright`A summary.` We used Console colors, including BackgroundColor and ForegroundColor. The ResetColors method, and the Console.WindowWidth property were also used.

OIHUVHHIDIQ;V I{<-- You need this IwI5HHVIJIAH{HOI%O{VHOO//HOOI{1. Type UI5UIVpress U.UHOOI{2. Select UBackgroundColorU.HOOI{3. Press spaceIVU=U, then press tab.HOO//HOOVI5.VBackgroundColorVIyI5Color.Blue;HOOI5.VForegroundColorVIyI5Color.White;HOOI'VUWhite on blue.UV);HOOI'VUAnother line.UV);V I{<-- This line is still white on blue.HOOVI5.VResetColorV();HO}H}VHHIDIQIbIJIAH{HOI%O{VHOO//HOOI{Ia one green line.HOO//HOOVIaFullLine(VUThis line is green.UV);HOOI');VHOO//HOOI{Ia another green line.HOO//HOOVIaFullLine(VUThis line is also green.UV);HOOI');HO}HHOI?IcIaFullLine(IP Ih)HO{VHOO//HOOI{This mIg writes an entire lineIjthe console with the IP.HOO//HOOVI5.BackgroundColorIyI5Color.Green;HOOI5.ForegroundColorIyI5Color.DarkGreen;HOOI'Ih.PadRight(I5.WindowWidth - 1));V I{<-- see noteHOO//HOOI{Reset the color.HOO//HOOVI5.ResetColor();HO}H}VHHIDIQIbIJIAH{HOI%O{VHOO//HOOI{This program demonstrates all colorsIVbackgrounds.HOO//HOOVType typeIytypeof(I5Color);HOOI5.VForegroundColorVIyI5Color.White;HOOVI@V (var nameIpEnum.GetNames(type))HOO{HOOOI5.VBackgroundColorVIy(I5Color)Enum.Parse(type, name);HOOOI'name);HOO}HOOI5.VBackgroundColorVIyI5Color.Black;HOOVI@V (var nameIpEnum.GetNames(type))HOO{HOOOI5.VForegroundColorVIy(I5Color)Enum.Parse(type, name);HOOOI'name);HOO}HO}H}HHVHHBlackHDarkBlueHDarkGreenHDarkCyanHDarkRedHDarkMagentaHDarkYellowHGrayHDarkGrayHBlueHGreenHCyanHRedHMagentaHYellowHWhiteHBlackHDarkBlueHDarkGreenHDarkCyanHDarkRedHDarkMagentaHDarkYellowHGrayHDarkGrayHBlueHGreenHCyanHRedHMagentaHYellowHWhiteV

#sb8BackgroundColor and ForegroundColorpadding and colorsshows all console colors