What does this look like? Well, the following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<markup> | |
The following text is <colour colour="red">Red</colour><br /> | |
The following text is <colour colour="green" bright="true">Bright Green</colour><br /> | |
</markup> |
The idea here is that if the terminal at the other end supports ANSI colours, then ANSI colour escape sequences will be emitted as appropriate to change the colours. If the terminal doesn't support colour at all then no colours will be emitted but the text still will. This way you don't get garbage on the screen because of your terminal settings, and you don't need to configure your terminal to work the way the server expects.
I've only done colours, newlines and underlines so far, but it works pretty well. More will be added as necessary.
No comments:
Post a Comment