| | 1 | #include <tads.h> |
| | 2 | |
| | 3 | main(args) |
| | 4 | { |
| | 5 | "This is a test of setting text colors. |
| | 6 | <font color=red>Red</font> |
| | 7 | <font color=blue>Blue</font> |
| | 8 | <font color=green>Green</font> |
| | 9 | |
| | 10 | <b> |
| | 11 | <font color=red>Bright Red</font> |
| | 12 | <font color=blue>Bright Blue</font> |
| | 13 | <font color=green>Bright Green</font> |
| | 14 | </b> |
| | 15 | |
| | 16 | <p>Finally, here's some <b>ordinary text in bold mode</b>, to |
| | 17 | see that we use the parameterized highlight setting rather than |
| | 18 | just high-intensity normal text; and |
| | 19 | <font color=white>explicitly white text <b>in bold</b>, to see |
| | 20 | that we don't use parameters for that;</font> and finally |
| | 21 | some <b>bold text with <font color=white>explicit white</font> |
| | 22 | within.</b> |
| | 23 | |
| | 24 | <p> |
| | 25 | That's about all for now!"; |
| | 26 | |
| | 27 | for (;;) |
| | 28 | { |
| | 29 | local txt; |
| | 30 | |
| | 31 | "\bEnter a color name, or 'Q' to quit. Type SCREEN <color> |
| | 32 | to set the screen color, or FULL <fgcolor> <bgcolor> to set both |
| | 33 | the foreground and background colors.\n> "; |
| | 34 | |
| | 35 | txt = inputLine(); |
| | 36 | if (txt == nil || txt == 'q' || txt == 'Q') |
| | 37 | break; |
| | 38 | |
| | 39 | /* check for special commands */ |
| | 40 | if (rexMatch('<nocase>screen +(.+)', txt) != nil) |
| | 41 | { |
| | 42 | "Okay, setting the screen color...\n |
| | 43 | <body bgcolor='<<rexGroup(1)[3]>>'> |
| | 44 | Done! "; |
| | 45 | } |
| | 46 | else if (rexMatch('<nocase>full +(.+) +(.+)', txt) != nil) |
| | 47 | { |
| | 48 | local fg = rexGroup(1)[3]; |
| | 49 | local bg = rexGroup(2)[3]; |
| | 50 | |
| | 51 | "Trying both foreground and background colors... |
| | 52 | <font color=<<fg>> bgcolor=<<bg>>> |
| | 53 | Here it is: color=<<fg>> and bgcolor=<<bg>>. |
| | 54 | Let's try <b>some bold text</b> too. |
| | 55 | </font> |
| | 56 | Okay, done with that. "; |
| | 57 | } |
| | 58 | else if (txt != '') |
| | 59 | { |
| | 60 | "<font color='<<txt>>'>Here's <<txt>>! <b>And in |
| | 61 | bold!</b></font>"; |
| | 62 | } |
| | 63 | } |
| | 64 | |
| | 65 | "Bye!\b"; |
| | 66 | } |