30 Dec, 2014, CurryMUD wrote in the 1st comment:
Votes: 0
Hi everyone, occasional lurker and first-time poster here.
I'm writing a MUD server in Haskell; been working on it for over a year now. I've started to experiment with putting ANSI color escape sequences in the text that my server sends, and I have some questions.
I know that MUD clients can and do have their own configurable settings when it comes to color. Since that is the case, how can/should a server use color?
In particular, what worries me is this: what if, for example, I occasionally use blue for emphasis or some other effect, and a player has set their client to use a blue background?
Are there MUDs that set the background color?
Lastly, should I always send the ANSI "reset" code after having temporarily changed the color?
Thanks!
31 Dec, 2014, mudrammer wrote in the 2nd comment:
Votes: 0
CurryMUD said:
Since that is the case, how can/should a server use color?
In particular, what worries me is this: what if, for example, I occasionally use blue for emphasis or some other effect, and a player has set their client to use a blue background?


Ahoy! I am the author of a MUD client that supports themes, including custom background colors. You should use as many or as few colors as you like and you should assume your user's client will display them properly.

The vast majority of MUD clients will display colors using one of the sets of 16 standard ANSI colors.

If the user selects a different background color, my client – and most other clients that have themes – will adjust the displayed colors as appropriate to ensure they are visible on the user's current background. That is to say, you should feel free to use the color blue for emphasis, but you cannot really know what color will be displayed to the user: maybe it'll be some shade of blue, or maybe another color entirely. And that's okay, because users will want colors displayed in a style that suits their tastes.

Quote
Are there MUDs that set the background color?


Not for the window background, no, but many MUDs use SGR codes to apply background colors (or strike-through, or underlining, etc) to particular ranges of text. There's an exhaustive list of those codes on the wiki page I linked above.

Quote
Lastly, should I always send the ANSI "reset" code after having temporarily changed the color?


Yes, always, lest your users suffer an untimely death from color bleeding. :)
31 Dec, 2014, Ssolvarain wrote in the 3rd comment:
Votes: 0
I think most people have already replaced ansi's blues with different colored blues by now anyways. Things were impossible to read.
31 Dec, 2014, CurryMUD wrote in the 4th comment:
Votes: 0
Thank you very much for your replies! I did not realize that modern clients have themes. It's good to know that I ought to be able to trust the client to adjust the colors I send from my server so as to ensure that text is visible to the player.
31 Dec, 2014, SlySven wrote in the 5th comment:
Votes: 0
A Client could theoretically offers support for the MUD server setting those ANSI colours via a code sequence known as OSC {Operating System Command} which is the ASCII ESC (\x1b) followed by the ']' character and then some parameters - compare that with the more familiar SGR {Set Graphics Rendition} which uses ESC followed by ' those ANSI colours via a code sequence known as OSC {Operating System Command} which is the ASCII ESC (\x1b) followed by the ']' character and then some parameters - compare that with the more familiar SGR {Set Graphics Rendition} which uses ESC followed by '['. Mudlet, the one I'm involved with, doesn't do that, but as others have suggested in general about clients, it does permit the user to redefine what each of the 16 ANSI Colours are. If the user wants to map all the colours to different shades of pink that is down to them, but a MUD server should assume the colour choices the user makes broadly follow the colour scheme that the Wikipedia reference given above refers to.

Please don't forget though that some MUD players are blind or have colour blindness so consider that colour alone may not be a wise choice to indicate vital information without at least making an alternative available if the user asks (and can know to ask).
31 Dec, 2014, CurryMUD wrote in the 6th comment:
Votes: 0
SlySven, thanks for your reply. I'm developing on a Mac and have been using Mudlet extensively for testing.

I used to play a MUD that had support for blind players, though I don't know what kind of support.

I'd like to make my MUD accessible to blind/visually impaired players as well, but I don't quite know where to begin.
Should I provide a special server-side color scheme, or just assume that players will configure their clients to suit their needs when it comes to color?
Beyond that, what can/should be done? Is the main idea to make a MUD as screen reader-friendly as possible (meaning, take measures to cut down on spam)?
31 Dec, 2014, quixadhal wrote in the 7th comment:
Votes: 0


and

02 Jan, 2015, SlySven wrote in the 8th comment:
Votes: 0
I'm curious, quixadhal, which MUD Server / Client?
02 Jan, 2015, quixadhal wrote in the 9th comment:
Votes: 0
The code is in LPC, for the Dead Souls mudlib, but it's just following the XTERM-256 standard. I also shift to the closest color match for other modes (such as ANSI or greyscale), so the game itself always uses the 256 color tokens. The latter screenshot was from the Gurba mudlib for DGD (also LPC, but a different dialect). It had symbolic color support by adding a second pass to the translation.

So, using an extended Pinkfish standard, you'd write things in your code or data files that look like %^POISON%^, which would (perhaps) be translated to %^OliveGreen%^, which would then get mapped to the appropriate escape sequence for the terminal type of the client, or removed entirely for unknown terminals.

This is a perl script which generates the LPC files, along with test code for C and C++. I also have a somewhat different implementation of the same concept (not with XTERM-256, but doing translations) for a Python ROM workalike.

You can also paw through the bloodlines git repository to see how it's integrated into the mudlib, but unless you're using that mudlib, it may be more confusing than looking at the other stuff. :)

For the above image, here are the ANSI and greyscale versions, which are translated as I described above.

0.0/9