Add support for VT100 terminal color ESC sequences #10105
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Show and Tell @FoamyGuy demonstrated how he was able to modify the terminal font color which got me thinking that the same functionality could be used to enable the VT100 Escape sequences for setting the terminal background and foreground. This PR adds support for all the color attributes as well as the reset to default sequence.
I used the following code.py file to test the functionality:
Entering
[44m
at the prompt sets the background to blue and entering[30;41m
will set the foreground to black and the background to red.Although many terminal programs run from host computers will respond to the same escape sequences this PR has nothing to do with controlling the attributes of a terminal session from a host computer, rather it sets the attributes on an attached display like a TFT Featherwing. If the board doesn't bring up the display automatically, you may need to add the initialization code to the code.py file as well.