public void Write(string message, ConsoleColor? background, ConsoleColor? foreground) { var consoleContext = new ConsoleContext(); consoleContext.Message = message; if (background.HasValue) { consoleContext.BackgroundColor = background.Value; } if (foreground.HasValue) { consoleContext.ForegroundColor = foreground.Value; } _sink.Write(consoleContext); ResetColor(); }
public void OnParseWrite(string message, int startIndex, int length, ConsoleColor?background, ConsoleColor?foreground) { var consoleContext = new ConsoleContext(); consoleContext.Message = message.AsSpan().Slice(startIndex, length).ToString(); if (background.HasValue) { consoleContext.BackgroundColor = background.Value; } if (foreground.HasValue) { consoleContext.ForegroundColor = foreground.Value; } _sink.Write(consoleContext); ResetColor(); }
public void Write(string message, ConsoleColor?background, ConsoleColor?foreground) { var consoleContext = new ConsoleContext(); consoleContext.Message = message; if (background.HasValue) { consoleContext.BackgroundColor = background.Value; } if (foreground.HasValue) { consoleContext.ForegroundColor = foreground.Value; } _sink.Write(consoleContext); ResetColor(); }
public void Write(ConsoleContext context) { Writes.Add(context); }