public string Adapt(ConsoleTokens expression) { var buffer = new StringBuilder(); foreach (var item in expression) { buffer.Append(item.State); } return(buffer.ToString()); }
public string Adapt(ConsoleTokens expression) { var buffer = new StringBuilder(); foreach (var item in expression) { if (item.Action == "red") { buffer.Append($"\x1b[31m{item.State}\x1b[39m"); } else if (item.Action == "normal") { buffer.Append($"\x1b[39m{item.State}"); } else { buffer.Append(item.State); } } return(buffer.ToString()); }