using Pastel; namespace Yuanshen.Common.Console; public static class ConsoleBanner { private static readonly string[] Art = { @"██╗ ██╗██╗ ██╗ █████╗ ███╗ ██╗███████╗██╗ ██╗███████╗███╗ ██╗", @"╚██╗ ██╔╝██║ ██║██╔══██╗████╗ ██║██╔════╝██║ ██║██╔════╝████╗ ██║", @" ╚████╔╝ ██║ ██║███████║██╔██╗ ██║███████╗███████║█████╗ ██╔██╗ ██║", @" ╚██╔╝ ██║ ██║██╔══██║██║╚██╗██║╚════██║██╔══██║██╔══╝ ██║╚██╗██║", @" ██║ ╚██████╔╝██║ ██║██║ ╚████║███████║██║ ██║███████╗██║ ╚████║", @" ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝" }; private const int RuleWidth = 70; public static void Print(string title, IReadOnlyList<(string Key, string Value)> rows) { ConsoleTheme.Enable(); System.Console.WriteLine(); for (int i = 0; i < Art.Length; i++) { double t = (double)i / Math.Max(Art.Length - 1, 1); string rendered = ConsoleTheme.Gradient( Art[i], ConsoleTheme.Lerp(ConsoleTheme.GradientFrom, ConsoleTheme.GradientTo, t * 0.5), ConsoleTheme.Lerp(ConsoleTheme.GradientFrom, ConsoleTheme.GradientTo, 0.5 + t * 0.5)); System.Console.WriteLine(ConsoleTheme.Center(Art[i], rendered)); } System.Console.WriteLine(); System.Console.WriteLine(ConsoleTheme.Center(title, ConsoleTheme.Gradient(title))); System.Console.WriteLine(); string rule = new('─', RuleWidth); System.Console.WriteLine(ConsoleTheme.Center(rule, rule.Pastel(ConsoleTheme.Muted))); foreach ((string key, string value) in rows) { string plain = $"{key,-14}{value}"; string rendered = $"{key,-14}".Pastel(ConsoleTheme.Accent) + value.Pastel(ConsoleTheme.Text); System.Console.WriteLine(ConsoleTheme.Center(plain, rendered)); } System.Console.WriteLine(ConsoleTheme.Center(rule, rule.Pastel(ConsoleTheme.Muted))); System.Console.WriteLine(); } }