Difference between revisions of "How To ANSI"
(Created page with "=So You Want To Play With ANSI= Promise, it isn't arcane wizardry. It's really pretty simple. To start off with, there are two types of ANSI colour codes: ANSI 16 and HTML 2...") |
(No difference)
|
Revision as of 19:35, 16 June 2017
So You Want To Play With ANSI
Promise, it isn't arcane wizardry. It's really pretty simple.
To start off with, there are two types of ANSI colour codes: ANSI 16 and HTML 256.
The very top table on this page shows you the basic 16 colours ANY MU* client can view.
(Clients like, for example, SimpleMU are too out of date to view HTML 256.)
This information is available in non-wiki form within any TinyMUX game's default 'help' system as the following, sometimes much more elaborate, helpfiles:
- help ansi
- help ansi()
- help ansi codes
- help ansi substitution
Basic ANSI
Say you have a comtitle, and you want it to be red. The way the code works, you can do this in one of two ways: you can use substitutions, or you can use a function.
Quick explanation:
- Substitution = shortcut text
- Function = those things that end in () like ansi() and do mysterious magical code stuff
For things like comtitles, it tends to be easier to use substitutions. They're quicker to type.
See the helpfiles below for code:
ANSI CODES f - flash i - inverse h - highlight n - normal u - underline x - black foreground X - black background r - red foreground R - red background g - green foreground G - green background y - yellow foreground Y - yellow background b - blue foreground B - blue background m - magenta foreground M - magenta background c - cyan foreground C - cyan background w - white foreground W - white background <#RRGGBB> HTML color code <R G B> RGB decimal vector / Background indicator prefix Examples: ansi(fc, Test) would highlight "Test" is flashing cyan. ansi(<#FF8040>/<#800080>, Test) uses Orange on Dark Purple.
The information above is located in 'help ansi codes' IG.
Each of those letters stands for a particular colour in standard ANSI 16. By default, they are the "dark" colours. If you "highlight" them, they are the bright version of those colours.
Depending on your client's configuration, be warned -- UNHIGHLIGHTED black may show up as .. well, black. Typically, most people go into their client's settings and turn ANSI black into a really dark grey instead. In the example below, I have made it #303030 instead of #000000 for visibility's sake.
ANSI 16 text on a black background:
ANSI 16 | ANSI 16 |
---|---|
%xx [ansi(x,TEXT)] | %xh%xx [ansi(hx,TEXT)] |
%xr [ansi(r,TEXT)] | %xh%xr [ansi(hr,TEXT)] |
%xg [ansi(g,TEXT)] | %xh%xg [ansi(hg,TEXT)] |
%xy [ansi(y,TEXT)] | %xh%xy [ansi(hy,TEXT)] |
%xb [ansi(b,TEXT)] | %xh%xb [ansi(hb,TEXT)] |
%xm [ansi(m,TEXT)] | %xh%xm [ansi(hm,TEXT)] |
%xc [ansi(c,TEXT)] | %xh%xc [ansi(hc,TEXT)] |
%xw [ansi(w,TEXT)] | %xh%xw [ansi(hw,TEXT)] |
Backgrounds: Note that backgrounds in ANSI 16 cannot be highlighted.
ANSI 16 |
---|
%xX [ansi(X,TEXT)] |
%xR [ansi(R,TEXT)] |
%xG [ansi(G,TEXT)] |
%xY [ansi(Y,TEXT)] |
%xB [ansi(B,TEXT)] |
%xM [ansi(M,TEXT)] |
%xC [ansi(C,TEXT)] |
%xW [ansi(W,TEXT)] |
HTML 256 text on a black background:
HTML 256 | HTML 256 |
---|---|
%x<#5f00ff> [ansi(<#5f00ff>,TEXT)] | %x<#0087d7> [ansi(<#0087d7>,TEXT)] |
%x<#00af87> [ansi(<#00af87>,TEXT)] | %x<#afd700> [ansi(<#afd700>,TEXT)] |
%x<#ffd700> [ansi(<#ffd700>,TEXT)] | %x<#ff8700> [ansi(<#ff8700>,TEXT)] |
HTML 256 backgrounds with ANSI Black text:
HTML 256 | HTML 256 |
---|---|
%X<#5f00ff> [ansi(x/<#5f00ff>,TEXT)] | %X<#0087d7> [ansi(x/<#0087d7>,TEXT)] |
%X<#00af87> [ansi(x/<#00af87>,TEXT)] | %X<#afd700> [ansi(x/<#afd700>,TEXT)] |
%X<#ffd700> [ansi(x/<#ffd700>,TEXT)] | %X<#ff8700> [ansi(x/<#ff8700>,TEXT)] |
ANSI SUBSTITUTION The ANSI percent substitutions (%x, %X, %c, and %C) can be used instead of ansi(), and they are more efficient. For example, the equivalent to '[ansi(rBf,Color!)]' would be: '%xr%xB%xfColor!%xn'. The %xn (return to normal) is understood and therefore optional. %x is equivalent to %c, and %X is equivalent to %C, however, translate() always produces sequences of %x and %X. So, %x and %X are 'preferred'. The color code following %x or %X can be: Single letter (%xb, %xc, %xf, %xg, %xh, %xi, %xm, %xn, %xr, %xu, %xw, %xx, %xy, %xB, %xC, %xG, %xM, %xR, %xW, %xX, and %xY) HTML color code (%x<#RRGGBB> or %x<#000000> through %x<#FFFFFF>) RGB decimal vector (%x<R G B> or %x<0 0 0> through %x<255 255 255>) Red, Green, and Blue are abbreviated as R, G, and B. For the single-letter form, the case of the letter determines whether the color specifies foreground (lower-case) or background (upper-case). For the HTML and decimal-vector forms, the case of the %x or %X determines whether the specified color is foreground or background.