1 using System;
2
3 namespace System
4 {
5 public enum ConsoleColor : byte
6 {
7 black = 0u, darkBlue = 1u, darkGreen = 2u, darkCyan = 3u, darkRed = 4u, darkYellow = 6u, gray = 7u,
8 darkGray = 8u, blue = 9u, green = 10u, cyan = 11u, red = 12u, magenta = 13u, yellow = 14u, white = 15u,
9 defaultColor = 0xFFu
10 }
11
12 public nothrow ConsoleColor DefaultConsoleBackColor()
13 {
14 return ConsoleColor.black;
15 }
16
17 public nothrow ConsoleColor DefaultConsoleTextColor()
18 {
19 return ConsoleColor.gray;
20 }
21
22 public const uchar colorChar = cast<uchar>(0x100000u);
23 public const uchar resetColors = cast<uchar>(0x10FFFDu);
24
25 public nothrow uchar ColorChar(ConsoleColor foreColor, ConsoleColor backColor)
26 {
27 return cast<uchar>(cast<uint>(colorChar) | cast<uint>(cast<ushort>(cast<byte>(foreColor)) | (cast<ushort>(cast<byte>(backColor)) << 8u)));
28 }
29
30 public nothrow string SetColors(ConsoleColor foreColor, ConsoleColor backColor)
31 {
32 return ToUtf8(ustring(ColorChar(foreColor, backColor)));
33 }
34
35 public nothrow string ResetColors()
36 {
37 return ToUtf8(ustring(resetColors));
38 }
39 }