// Can be improved public static void DrawButton(this SadConsole.Console console, int x, int y, string text, string key, Color keyColor, bool windowCentered) { var bracketA = new SadConsole.ColoredString("["); bracketA.SetForeground(console.DefaultForeground); var bracketB = new SadConsole.ColoredString("] "); bracketB.SetForeground(console.DefaultForeground); var prefix = new SadConsole.ColoredString($"{key}"); prefix.SetForeground(keyColor); var suffix = new SadConsole.ColoredString($"{text}"); suffix.SetForeground(console.DefaultForeground); var button = new SadConsole.ColoredString(""); button.SetForeground(console.DefaultForeground); button.SetBackground(console.DefaultBackground); button += bracketA + prefix + bracketB + suffix; int _x = windowCentered ? (console.Width / 2 - (button.Count / 2)) : x; console.Print(_x, y, button); }
public static void DrawHeader(this SadConsole.Console console, int y, string title, Color foregroundColor, Color backgroundColor) { var str = new SadConsole.ColoredString(); str.String = title; str.SetForeground(foregroundColor); str.SetBackground(backgroundColor); console.Print(console.Width / 2 - (str.Count / 2), y, str); }