About
Home
History
Clients
Specification
Comprehensive
For MUD Clients
Implementation
256 Colors
IBM Chars
Utilities
MUSHii
External
8BitMUSH

Introduction
FANSI combines the IBM/OEM (code page 437) extended characters, xterm's 256 color extension, and a small subset of MXP (only if necessary) to provide extended ANSI art capabilities on MUDs.

Compatibility
Of concern to the design of FANSI 2.0 is that the standard is compatible with a large number of MUD clients, and further that players without compatibility are not drastically effected. Users without FANSI capability (in one or more ways) should still able to distinguish the basic shapes and colors of the FANSI artwork seen by them, in most cases being able to make out the subject matter of the artwork being viewed by them. This is accomplished through a variety of methods:

  • Users with MXP support, but no support for xterm's 256 colors, will have the MUD server convert xterm colors to equivalent MXP colors.
  • Users with no support for 256 colors will have the MUD server downconvert the 256 colors to the standard 16 ANSI colors.
  • Users lacking support for some or all of the extended IBM/OEM characters will have them converted into equivalent looking standard ASCII characters.
  • In the situation where a user simply has chosen not to turn on a font with IBM/OEM characters (or are unable to do so), but are able to view the ISO 8859-1 extended characters, the server will use this additional character set to better match IBM/OEM extended characters to similar looking equivalents.
  • A FANSI compatibility test should be taken by users in order to determine their exact FANSI capabilities.

As an example, here is a screenshot from 8BitMUSH's Smurf Village area, with FANSI support enabled:
Smurf Village (FANSI on)

Now here is how the same FANSI art would look to a user without support for FANSI art (specifically, the extended IBM/OEM characters):

Smurf Village (No Fansi)

Both pictures can be easily determined to be a picture of the "Smurf Village."

FANSI Compatibility Test
In order to determine each user's level of support for FANSI, a series of color tests should be performed in the starting room or chargen (character generation) of the MUD, and anytime thereafter at the user's request. The test should roughly follow this flow:

  1. Ask the user to select their client from a list, or to select "Other" for a client not on the list. This is necessary because some clients have certain extended characters they cannot view correctly, and each client has a different set of configuration instructions.
  2. Output a series of instructions on a per-client basis that assists the player in configuring their client for optimal FANSI support. (Up to date per-client instructions are available on the Clients page.)
  3. Determine if the user's client supports extended IBM/OEM characters by asking them to view a FANSI picture and input something about that picture (such as a word or number in it.)
  4. If a user's client does not support extended IBM/OEM characters, determine if it supports ISO 8859-1 extended characters (by performing a similar test as above.)
  5. Determine if the user's client supports XTERM's 256 colors by performing a similar color test. (For example, show the user two red ANSI squares and one orange XTerm 256 square, and then ask them to input what they see).
  6. If the user does not support XTERM's 256 colors, determine if their client supports MXP colors. (See the MXP section below for more information on how to display MXP colors.)
  7. Inform them of their FANSI compatibility, including any deficiencies determined from the tests or simply from their client choice, and then configure the MUD to output to their character accordingly.

XTERM 256 Colors

XTERM's 256 colors are sent to the client using ANSI-style escape codes in the following format:

Foreground color change: <ANSI escape code>[38;5;<0-255>m
Background color change: <ANSI escape code>[48;5;<0-255>m

To reset fore and background colors to their defaults: <ANSI escape code>[0m

The <ANSI escape code> is ASCII character 27.

The <0-255> number is the color number, which is organized as follows:

  • 0 through 15 are the same as the first 16 standard ANSI colors. (In order: black, red, green, yellow, blue, magenta, cyan, white, bright black, bright red, bright green, bright yellow, bright blue, bright magenta, bright cyan, and bright white.)
  • 16 through 231 are a red/green/blue 6x6x6 color cube based upon the formula:
    16 + (<Red> * 36) + (<Green> * 6) + <Blue>
    where <Red>, <Green>, and <Blue> are values from 0 to 5.
  • 232 through 255 are 24 tone grayscale ramp gradiating from black to bright gray.

A color table of red/green/blue and hex color values of the XTerm 256 colors is provided below:

# R G B HEX
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
95
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
175
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
215
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
255
0
18
28
38
48
58
68
78
88
98
108
118
128
138
148
158
168
178
188
198
208
218
228
238
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
0
0
0
0
0
95
95
95
95
95
95
135
135
135
135
135
135
175
175
175
175
175
175
215
215
215
215
215
215
255
255
255
255
255
255
0
18
28
38
48
58
68
78
88
98
108
118
128
138
148
158
168
178
188
198
208
218
228
238
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
95
135
175
215
255
0
18
28
38
48
58
68
78
88
98
108
118
128
138
148
158
168
178
188
198
208
218
228
238
#000000
#00005F
#000087
#0000AF
#0000D7
#0000FF
#005F00
#005F5F
#005F87
#005FAF
#005FD7
#005FFF
#008700
#00875F
#008787
#0087AF
#0087D7
#0087FF
#00AF00
#00AF5F
#00AF87
#00AFAF
#00AFD7
#00AFFF
#00D700
#00D75F
#00D787
#00D7AF
#00D7D7
#00D7FF
#00FF00
#00FF5F
#00FF87
#00FFAF
#00FFD7
#00FFFF
#5F0000
#5F005F
#5F0087
#5F00AF
#5F00D7
#5F00FF
#5F5F00
#5F5F5F
#5F5F87
#5F5FAF
#5F5FD7
#5F5FFF
#5F8700
#5F875F
#5F8787
#5F87AF
#5F87D7
#5F87FF
#5FAF00
#5FAF5F
#5FAF87
#5FAFAF
#5FAFD7
#5FAFFF
#5FD700
#5FD75F
#5FD787
#5FD7AF
#5FD7D7
#5FD7FF
#5FFF00
#5FFF5F
#5FFF87
#5FFFAF
#5FFFD7
#5FFFFF
#870000
#87005F
#870087
#8700AF
#8700D7
#8700FF
#875F00
#875F5F
#875F87
#875FAF
#875FD7
#875FFF
#878700
#87875F
#878787
#8787AF
#8787D7
#8787FF
#87AF00
#87AF5F
#87AF87
#87AFAF
#87AFD7
#87AFFF
#87D700
#87D75F
#87D787
#87D7AF
#87D7D7
#87D7FF
#87FF00
#87FF5F
#87FF87
#87FFAF
#87FFD7
#87FFFF
#AF0000
#AF005F
#AF0087
#AF00AF
#AF00D7
#AF00FF
#AF5F00
#AF5F5F
#AF5F87
#AF5FAF
#AF5FD7
#AF5FFF
#AF8700
#AF875F
#AF8787
#AF87AF
#AF87D7
#AF87FF
#AFAF00
#AFAF5F
#AFAF87
#AFAFAF
#AFAFD7
#AFAFFF
#AFD700
#AFD75F
#AFD787
#AFD7AF
#AFD7D7
#AFD7FF
#AFFF00
#AFFF5F
#AFFF87
#AFFFAF
#AFFFD7
#AFFFFF
#D70000
#D7005F
#D70087
#D700AF
#D700D7
#D700FF
#D75F00
#D75F5F
#D75F87
#D75FAF
#D75FD7
#D75FFF
#D78700
#D7875F
#D78787
#D787AF
#D787D7
#D787FF
#D7AF00
#D7AF5F
#D7AF87
#D7AFAF
#D7AFD7
#D7AFFF
#D7D700
#D7D75F
#D7D787
#D7D7AF
#D7D7D7
#D7D7FF
#D7FF00
#D7FF5F
#D7FF87
#D7FFAF
#D7FFD7
#D7FFFF
#FF0000
#FF005F
#FF0087
#FF00AF
#FF00D7
#FF00FF
#FF5F00
#FF5F5F
#FF5F87
#FF5FAF
#FF5FD7
#FF5FFF
#FF8700
#FF875F
#FF8787
#FF87AF
#FF87D7
#FF87FF
#FFAF00
#FFAF5F
#FFAF87
#FFAFAF
#FFAFD7
#FFAFFF
#FFD700
#FFD75F
#FFD787
#FFD7AF
#FFD7D7
#FFD7FF
#FFFF00
#FFFF5F
#FFFF87
#FFFFAF
#FFFFD7
#FFFFFF
#000000
#121212
#1C1C1C
#262626
#303030
#3A3A3A
#444444
#4E4E4E
#585858
#626262
#6C6C6C
#767676
#808080
#8A8A8A
#949494
#9E9E9E
#A8A8A8
#B2B2B2
#BCBCBC
#C6C6C6
#D0D0D0
#DADADA
#E4E4E4
#EEEEEE

IBM/OEM Code Page 437 Extended Characters

FANSI supports the use of 151 "extended ASCII" characters, from the IBM/OEM (code page 437) font. These characters are:

☺♥♦♣♠♫☼►◄↕‼¶§‗↨↑↓→∟↔▲▼⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿¬¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘
╒╓╫╪┘┌█▄▌▐▀αβΓπΣδμτФθΩδ∞øЄ∩≡±≥≤⌠⌡÷≈º•·√ⁿ²■

The ASCII values for these characters are:

  • 1
  • 3 through 6
  • 14 through 26
  • 28 through 31
  • 127 through 254

This can be implemented in MUD clients either through a font containing the symbols above at the ascii values above (such as the "Terminal" font available in Windows), or by using any fixed-width font for the non-extended characters (ASCII values 32 through 126), and then a same size fixed-width font containing appropriate Unicode replacement values for these extended characters (such as Courier New.) See the IBM/OEM Implementation page for code for a Unicode replacement array.

MXP As An XTerm 256 Replacement

Clients without support for XTerm's 256 colors, but support for MXP (MUD eXtension Protocol) should have MXP <COLOR> tags output to them from the MUD server in replacement of XTerm 256 color terminal commands. The <COLOR> MXP tag can be truncated to the following:

<C (foreground hex color)>(text)</C>
<C B=(background hex color)>(text)</C>

The back and foreground hex color is the same color hex code provided in the previous color table.

As per MXP specifications, the tags should be prepended with:

<ANSI escape code>[1z

and appended with:

<ANSI escape code>[3z

For example:
<ANSI escape code>[1z<C #FFCA0D>Hello world</C><ANSI escape code>[3z

One last consideration, the characters in (text) may contain certain characters which could be interpretted incorrectly by a client as an MXP tag or something else. These characters should be replaced with their equivilant HTML entities. The following substitutions should be made on the (text) string:

< replaced with &lt;
> replaced with &gt;
& replaced with &amp;
" replaced with &quot;

This is a partial implementation of only one small aspect of MXP, which is all that is required for FANSI 2.0 support. See the MXP website for more information about MXP's many additional features.

256 Color To 16 Color Conversion

Users without clients capable of the 256 XTerm colors or MXP should have all of the 256 XTerm color codes downconverted into the standard 16 ANSI color codes before being sent to them. Because bright background colors are not allowed in standard ANSI, the background should be converted to the bottom 8. Algorithms exist to perform such downconversions. An example of such is available on the 256 Colors Implementation page.

If a user's client cannot properly display some or all of the IBM/OEM extended characters, the MUD server should convert those characters into similarily shaped standard ASCII characters. If the user views the ISO 8859-1 extended characters instead of the IBM/OEM extended characters (something determined by the FANSI Compatability Test, described previously) these characters can sometimes be used as better substitutions than standard ASCII characters, and in many cases match perfectly with extended characters in the IBM/OEM set. Below are tables of suggested substitutions in both of these cases:

IBM/OEM To Standard ASCII Conversion Table
Original Character Original ASCII Value Replacement Character Replacement ASCII Value












§










Ç
ü
é
â
ä
à
å
ç
ê
ë
è
ï
î
ì
Ä
Å
É
æ
Æ
ô
ö
ò
û
ù
ÿ
Ö
Ü
¢
£
¥

ƒ
á
í
ó
ú
ñ
Ñ
ª
º
¿
¬
¬
½
¼
¡
«
»
















































α
β
Γ
π
Σ
δ
μ
τ
Ф
θ
Ω
δ

ø
Є


±




÷

º

·


²
1
3
4
5
6
14
15
16
17
18
19
20
21
22
23
24
25
26
28
29
30
31
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
o
V
x
+
%
/
O
>
<
|
!
|
$
_
|
^
v
>
_
-
^
v
^
C
u
e
a
a
a
a
c
e
e
e
i
i
i
a
A
E
a
A
o
o
o
u
u
y
O
U
c
L
Y
P
f
a
i
o
u
n
N
a
o
?
_
_
%
%
!
<
>
%
#
@
|
|
|
|
n
=
|
|
=
=
|
|
-
|
=
=
|
-
+
|
|
=
=
=
=
=
=
+
=
|
=
-
u
=
f
n
|
+
|
+
#
_
|
|
~
a
B
r
n
E
o
u
r
o
0
O
o
8
o
E
n
E
+
>
<
|
J
%
~
o
.
.
v
n
2
#
111
86
120
37
43
47
79
62
60
124
33
124
36
95
124
94
118
62
95
45
94
118
94
67
117
101
97
97
97
97
99
101
101
101
105
105
105
97
65
69
97
65
111
111
111
117
117
121
79
85
99
76
89
80
102
97
105
111
117
110
78
97
111
63
95
95
37
37
33
60
62
37
35
64
124
124
124
124
110
61
124
124
61
61
124
124
45
124
61
61
124
45
43
124
124
61
61
61
61
61
61
43
61
124
61
45
117
61
102
110
124
43
124
43
35
95
124
124
126
97
66
114
110
69
111
117
114
111
48
79
111
56
111
69
110
69
43
62
60
124
74
37
126
111
46
46
118
110
50
35

IBM/OEM To ISO 8859-1 And/Or ASCII Conversion Table
Original Character (IBM/OEM) Original ASCII Value Replacement Character (ISO 8859-1) Replacement ASCII Value












§










Ç
ü
é
â
ä
à
å
ç
ê
ë
è
ï
î
ì
Ä
Å
É
æ
Æ
ô
ö
ò
û
ù
ÿ
Ö
Ü
¢
£
¥

ƒ
á
í
ó
ú
ñ
Ñ
ª
º
¿
¬
¬
½
¼
¡
«
»
















































α
β
Γ
π
Σ
δ
μ
τ
Ф
θ
Ω
δ

ø
Є


±




÷

º

·


²
1
3
4
5
6
14
15
16
17
18
19
20
21
22
23
24
25
26
28
29
30
31
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
Ò
V
×
%
þ
/
¤
>
<
|
¡

§

|
^
v
>
_
-
^
v

Ç
ü
é
â
ä
à
å
ç
ê
ë
è
ï
î
ì
Ä
Å
É
æ
Æ
ô
ö
ò
û
ù
y
Ö
Ü
¢
£
¥
P
ƒ
á
í
ó
ú
ñ
Ñ
ª
º
¿
_
¬
½
¼
¡
«
»
%
#
@
|
|
|
|
+
=
|
|
=
=
|
|
¬
|
=
=
|

+
|
|
=
=
=
=
=
=
+
=
|
=
-
u
=
+
n
|

|
+
#
_
|
|
-
a
ß
r


ð
µ
r

Ø
O
ð
œ
ø

n
E
±
»
«
|
|
÷
~
°

·
v
n
²
210
86
215
41
254
47
164
62
60
124
161
182
167
150
124
94
118
62
95
45
94
118
127
199
252
233
226
228
224
229
231
234
235
232
239
238
236
196
197
201
230
198
244
246
242
251
249
121
214
220
162
163
165
80
131
225
237
243
250
241
209
170
186
191
95
172
189
188
161
171
187
41
35
64
124
124
124
124
43
61
124
124
61
61
124
124
172
124
61
61
124
151
43
124
124
61
61
61
61
61
61
43
61
124
61
45
117
61
43
110
124
135
124
43
35
95
124
124
45
97
223
114
182
128
240
181
114
135
216
79
240
156
248
128
110
69
177
187
171
124
124
247
126
176
149
183
118
110
178
149

MUSHii

MUSHii is a mouse-driven FANSI art tool available on this site. It greatly simplifies the process of creating FANSI art, and its goal is to support exporting to any game with FANSI support.

It currently exports to MUSH/MUX games that are using the following functions to provide in-game access to FANSI characters and colors:

color(<fore 0-255>,<back 0-255>,<text>)
c(<char 0-254>)
and c(<char 0-254>,<repeat times>)

The implementation of these functions in PennMUSH is available on the Implementation pages.

If your game supports an alternate method of providing in-game access to FANSI, please email 8bitMUSH@gmail.com and request that MUSHii add export support for your game.