public void BasicColor() { var memory = new MemoryStream(); Terminal.Setup(memory); Terminal.Blue().Write("---").NoColor().Write("==="); Assert.Equal("\x1B[94m---\x1B[39m===", Encoding.UTF8.GetString(memory.ToArray())); }
public static void Blue() { if (Console.BackgroundColor == ConsoleColor.White) { Terminal.Blue(); } else { Terminal.Cyan(); } }
/// <summary> /// Initiates a Redscreen. /// </summary> /// <param name="error">Error title or exception name</param> /// <param name="description">Error description</param> /// <param name="critical">Critical error?</param> public static void Push(string error = "Something went wrong!", string description = "Unknown exception", bool critical = false) { DrawSplash(); if (description.Length + 33 < Console.WindowHeight) { Console.CursorTop = 2; Console.CursorLeft = 33; Terminal.Blue(error); Terminal.CursorTop = 4; Console.CursorLeft = 70; Terminal.White(description); } else { Console.CursorTop = 12; Console.CursorLeft = 2; Terminal.Blue(error); Terminal.CursorTop = 14; Console.CursorLeft = 2; Terminal.White(description); } if (!critical) { Terminal.CursorTop = Terminal.WindowHeight - 1; Terminal.White("Press the [Enter]-key to resume").newLine(); Terminal.CursorTop++; Terminal.ReadLine(); Terminal.Cls(); } else { Terminal.CursorTop = Terminal.WindowHeight - 4; Terminal.White("Press the [Enter]-key to shutdown").newLine(); Terminal.CursorTop++; Terminal.White("If it doesn't work, press the RESET-button on your computer.").newLine(); Terminal.CursorTop++; Terminal.ReadLine(); // ACPI.Shutdown(); } }