Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace colors
- {
- class Program
- {
- static void Main(string[] args)
- {
- ConsoleColor[] colors = AllColors();
- string name = Console.ReadLine();
- Random r = new Random();
- for (int i = 0; i < name.Length; i++)
- {
- Console.ForegroundColor = colors[r.Next(16)];
- Console.Write(name[i]);
- }
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine();
- }
- private static ConsoleColor[] AllColors()
- {
- ConsoleColor[] colors = new ConsoleColor[16];
- colors[0] = ConsoleColor.Black;
- colors[1] = ConsoleColor.Blue;
- colors[2] = ConsoleColor.Cyan;
- colors[3] = ConsoleColor.DarkBlue;
- colors[4] = ConsoleColor.DarkCyan;
- colors[5] = ConsoleColor.DarkGray;
- colors[6] = ConsoleColor.DarkGreen;
- colors[7] = ConsoleColor.DarkMagenta;
- colors[8] = ConsoleColor.DarkRed;
- colors[9] = ConsoleColor.DarkYellow;
- colors[10] = ConsoleColor.Gray;
- colors[11] = ConsoleColor.Green;
- colors[12] = ConsoleColor.Magenta;
- colors[13] = ConsoleColor.Red;
- colors[14] = ConsoleColor.White;
- colors[15] = ConsoleColor.Yellow;
- return colors;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement