public void Write(ITyperInformation typerInfo) { var currentFg = Console.ForegroundColor; var currentBg = Console.BackgroundColor; // Highlight already typed part. Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = ConsoleColor.DarkGray; Console.Write(typerInfo.Typed); // Highlight mistakes. Console.BackgroundColor = currentBg; Console.ForegroundColor = ConsoleColor.Red; Console.Write(typerInfo.Error); // Highlight the rest of text if typer is focused. Console.ForegroundColor = typerInfo.IsStartedTyping ? ConsoleColor.DarkYellow : currentFg; Console.Write(typerInfo.NotTyped); // Revert console color to default. Console.ForegroundColor = currentFg; }
public sealed record State( ITyperInformation CreateCharacterTyper, Dictionary <string, ITyperInformation> ConnectAsCharacterTypers);