We need a base class something like this, with constructor that optionally takes just the string
public class Text {
public string Text;
public Color? ForegroundColor;
public Color? BackgroundColor;
// override to output VT ANSI escape sequence
public override string ToString()
}
And then, a collection class which also has a constructor that optionally takes just the string, but also can cast from a that base Text class, or an array of them. It shouldn't just call the base Text object ToString(), because the key feature of this being an array is to optimize (not output extra escapes), and include a reset at the end of the output.
public class TextSpan {
public Text[] Text;
public Color? ForegroundColor;
public Color? BackgroundColor;
// this one includes a reset at the end, so text after it goes back to normal output
public override string ToString()
}
We need a base class something like this, with constructor that optionally takes just the string
And then, a collection class which also has a constructor that optionally takes just the string, but also can cast from a that base
Text
class, or an array of them. It shouldn't just call the base Text object ToString(), because the key feature of this being an array is to optimize (not output extra escapes), and include a reset at the end of the output.