Differences between revisions 4 and 5
Revision 4 as of 2006-11-08 18:46:56
Size: 1429
Editor: FChE
Comment:
Revision 5 as of 2008-01-10 19:47:25
Size: 1466
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
support the [http://en.wikipedia.org/wiki/ANSI_escape_code ANSI escape sequences] support the [[http://en.wikipedia.org/wiki/ANSI_escape_code|ANSI escape sequences]]
Line 12: Line 12:
Thanks to Eugene Teo. attachment:ansi_colors.stp Thanks to Eugene Teo. [[attachment:ansi_colors.stp]]
Line 36: Line 36:
[[ImageLink(ansi_colors.png)]] [[attachment:ansi_colors.png|{{attachment:ansi_colors.png}}]]

Eye Candy using ANSI Sequences

Problem

Plain text is sometimes a little too plain. Many terminal emulator programs support the ANSI escape sequences for marking up text in different ways.

Scripts

Thanks to Eugene Teo. ansi_colors.stp

probe begin {
        printf("a \\ b |");
        for (c = 40; c < 48; c++)
                printf("   %d   ", c);
        printf("\12");
        for (l = 0; l < 71; l++)
                printf("-");
        printf("\12");

        for (r = 30; r < 38; r++)
                for (t = 0; t < 2; t++) {
                        printf("%d    |", r);
                        for (c = 40; c < 48; c++)
                                printf("\033[%d;%d%s %s \033[0;0m",
                                        r, c, !t ? "m" : ";1m", !t ? "Normal" : "Bold  ");
                        printf("\12");
                }
        exit();
}

Output

attachment:ansi_colors.png

Lessons

  • One may use escape sequences in systemtap strings.
  • Avoid their overuse!
  • This area is a good candidate for turning into a set of tapset functions.


WarStories

None: WSEyeCandyUsingANSISequences (last edited 2008-01-10 19:47:25 by localhost)