FANSI/Xterm256

Is automatically downgrading xterm256 colors to their ANSI equivalents for those who are fansi off on the todo list?

I love using xterm256 colors but I have a few annoying friends who just will not give up SimpleMU.

1 Like

A global disable isn’t on the horizon at this point, but I could consider it if there were a big need for it.

That said, nothing in the default codebase uses the extended ansi colors (except the colors command itself) so you can make your game SimpleMU-friendly just by not utilizing the extra colors.

Also, individual characters can disable seeing extended ansi by doing fansi <on or off>.

Hm, I wasn’t clear :slight_smile:

I’m not wondering about a global disable, but the behavior on all MUSH codebases that support xterm256 colors is to “downgrade” to the “nearest regular ansi color” for users who can not see them.

Whereas Ares seems to output the codes as %x23 or what not. Like if I use %x38 in a skin line, for those who are fansi on they’d see the pretty color, but those that are fansi off would get cyan.

Oh! I see. Partly that’s a bug. The intended behavior was to simply not show the color at all. Seeing the color codes by themselves certainly isn’t useful!

Is there some kind of universal “downgrade” mapping? I confess… I look at the colors list and have no idea what to map half of those colors to. That’s why I initially just went with (attempting to) not show the colors at all. :slight_smile:

I know Rhost does it algorithmically, but I can’t find where the algorithm is in the code-- but I can pretty easily write up a table of xterm colors to ansi colors if you would use it.

Cuz turning them to colorless would be sad :slight_smile:

If you can provide a downgrade mapping, I’ll be glad to incorporate it.

Preferred format would be like a ruby hash mapping the FANSI number to the downgraded ansi color, but I’ll take what I can get :slight_smile:

{
  "45" => "c",
  "52" => "m",
   etc
}

Via:

think iter(lnum(0,255),"%i0" => "[colors(xterm%i0,c)]",%b,%,%r)

We get Rhost’s downgrade mapping. (The ‘c’ argument to colors says use-this-named-color and give me its ansi downgrade value)

{
	"0" => "x",
	"1" => "r",
	"2" => "g",
	"3" => "y",
	"4" => "b",
	"5" => "m",
	"6" => "c",
	"7" => "w",
	"8" => "xh",
	"9" => "rh",
	"10" => "gh",
	"11" => "yh",
	"12" => "bh",
	"13" => "mh",
	"14" => "ch",
	"15" => "wh",
	"16" => "x",
	"17" => "b",
	"18" => "b",
	"19" => "b",
	"20" => "bh",
	"21" => "bh",
	"22" => "g",
	"23" => "c",
	"24" => "b",
	"25" => "bh",
	"26" => "bh",
	"27" => "bh",
	"28" => "gh",
	"29" => "g",
	"30" => "c",
	"31" => "bh",
	"32" => "bh",
	"33" => "bh",
	"34" => "gh",
	"35" => "gh",
	"36" => "ch",
	"37" => "ch",
	"38" => "bh",
	"39" => "bh",
	"40" => "gh",
	"41" => "gh",
	"42" => "gh",
	"43" => "ch",
	"44" => "ch",
	"45" => "ch",
	"46" => "gh",
	"47" => "gh",
	"48" => "gh",
	"49" => "ch",
	"50" => "ch",
	"51" => "ch",
	"52" => "r",
	"53" => "m",
	"54" => "m",
	"55" => "mh",
	"56" => "bh",
	"57" => "bh",
	"58" => "g",
	"59" => "g",
	"60" => "c",
	"61" => "bh",
	"62" => "bh",
	"63" => "bh",
	"64" => "g",
	"65" => "g",
	"66" => "g",
	"67" => "c",
	"68" => "c",
	"69" => "bh",
	"70" => "gh",
	"71" => "g",
	"72" => "g",
	"73" => "c",
	"74" => "ch",
	"75" => "ch",
	"76" => "gh",
	"77" => "gh",
	"78" => "gh",
	"79" => "ch",
	"80" => "ch",
	"81" => "ch",
	"82" => "gh",
	"83" => "gh",
	"84" => "gh",
	"85" => "gh",
	"86" => "ch",
	"87" => "ch",
	"88" => "r",
	"89" => "r",
	"90" => "m",
	"91" => "m",
	"92" => "mh",
	"93" => "mh",
	"94" => "r",
	"95" => "r",
	"96" => "m",
	"97" => "m",
	"98" => "mh",
	"99" => "mh",
	"100" => "y",
	"101" => "y",
	"102" => "g",
	"103" => "c",
	"104" => "bh",
	"105" => "bh",
	"106" => "g",
	"107" => "g",
	"108" => "g",
	"109" => "c",
	"110" => "ch",
	"111" => "ch",
	"112" => "gh",
	"113" => "gh",
	"114" => "gh",
	"115" => "gh",
	"116" => "ch",
	"117" => "ch",
	"118" => "gh",
	"119" => "gh",
	"120" => "gh",
	"121" => "gh",
	"122" => "wh",
	"123" => "wh",
	"124" => "r",
	"125" => "m",
	"126" => "m",
	"127" => "mh",
	"128" => "mh",
	"129" => "mh",
	"130" => "rh",
	"131" => "rh",
	"132" => "rh",
	"133" => "mh",
	"134" => "mh",
	"135" => "mh",
	"136" => "y",
	"137" => "y",
	"138" => "mh",
	"139" => "mh",
	"140" => "mh",
	"141" => "mh",
	"142" => "y",
	"143" => "y",
	"144" => "y",
	"145" => "mh",
	"146" => "mh",
	"147" => "mh",
	"148" => "yh",
	"149" => "yh",
	"150" => "gh",
	"151" => "wh",
	"152" => "wh",
	"153" => "wh",
	"154" => "yh",
	"155" => "yh",
	"156" => "yh",
	"157" => "yh",
	"158" => "wh",
	"159" => "wh",
	"160" => "r",
	"161" => "rh",
	"162" => "mh",
	"163" => "mh",
	"164" => "mh",
	"165" => "mh",
	"166" => "rh",
	"167" => "rh",
	"168" => "rh",
	"169" => "mh",
	"170" => "mh",
	"171" => "mh",
	"172" => "y",
	"173" => "y",
	"174" => "y",
	"175" => "mh",
	"176" => "mh",
	"177" => "mh",
	"178" => "y",
	"179" => "y",
	"180" => "yh",
	"181" => "mh",
	"182" => "mh",
	"183" => "mh",
	"184" => "y",
	"185" => "y",
	"186" => "yh",
	"187" => "wh",
	"188" => "wh",
	"189" => "wh",
	"190" => "yw",
	"191" => "yw",
	"192" => "yh",
	"193" => "wh",
	"194" => "wh",
	"195" => "wh",
	"196" => "rh",
	"197" => "rh",
	"198" => "rh",
	"199" => "mh",
	"200" => "mh",
	"201" => "mh",
	"202" => "rh",
	"203" => "rh",
	"204" => "rh",
	"205" => "mh",
	"206" => "mh",
	"207" => "mh",
	"208" => "rh",
	"209" => "rh",
	"210" => "mh",
	"211" => "mh",
	"212" => "mh",
	"213" => "mh",
	"214" => "yh",
	"215" => "yh",
	"216" => "wh",
	"217" => "wh",
	"218" => "wh",
	"219" => "wh",
	"220" => "yh",
	"221" => "yh",
	"222" => "yh",
	"223" => "wh",
	"224" => "wh",
	"225" => "wh",
	"226" => "yh",
	"227" => "yh",
	"228" => "yh",
	"229" => "yh",
	"230" => "wh",
	"231" => "wh",
	"232" => "x",
	"233" => "x",
	"234" => "xh",
	"235" => "xh",
	"236" => "xh",
	"237" => "xh",
	"238" => "xh",
	"239" => "xh",
	"240" => "xh",
	"241" => "w",
	"242" => "w",
	"243" => "w",
	"244" => "w",
	"245" => "w",
	"246" => "w",
	"247" => "w",
	"248" => "wh",
	"249" => "wh",
	"250" => "wh",
	"251" => "wh",
	"252" => "wh",
	"253" => "wh",
	"254" => "wh",
	"255" => "wh"
}
1 Like