static private List <ConsoleText> Process(List <String> list, ConsoleColor textColor, ConsoleColor bgColor) { var result = new List <ConsoleText>(); foreach (var each in list) { var consoleText = new ConsoleText(); consoleText.Append(each, bgColor, textColor); result.Add(consoleText); } return(result); }
public void TestImplicit() { var consoleText = new ConsoleText(); consoleText.Append(ConsoleStyle.Red, true); consoleText.Append("a"); consoleText.Append(ConsoleStyle.Rgb(10, 20, 30).ToString()); consoleText.Append("b"); consoleText.Append(ConsoleStyle.Reset.ToString()); consoleText.Append("c"); var output = new StringWriter(); var writer = new ConsoleTextWriter(output); consoleText.Render(writer); writer.Commit(); Assert.AreEqual("\x1b[0m\x1b[31ma\x1b[0m\x1b[38;2;10;20;30mb\x1b[0m\x1b[31mc", output.ToString()); }