ZMP - Zenith MUD Protocol

This is the color package for ZMP.

Preamble

The color package is an optional package that clients and servers may implement to exert more control over color than is available with ANSI control codes.

Clients should provide a means to disable any server-specified color codes. Clients may also opt to allow users to modify color codes specified by the server, or use custom values for any ANSI color control codes.

Color Codes

Several of the commands in the color package take a color code as an argument. A color code is a hexadecimal value representing a particular color.

The format of a color code must be either three or six hexadecimal digits. The three-digit notation (#RGB) is converted into a six-digit notation (#RRGGBB) by replicating each digit, not by adding zeros. Therefor, FFF is equivalent to FFFFFF, not F0F0F0.

color.define

The color.define command allows the client and server to better coordinate their color usage. Traditionally, the server chooses color values for different types of output and sends raw color commands to the client. With this command, the server instead simply identifies output by category, and allows the client to apply its choice of color. The server tells the client which types of output to expect and its prefered color value. The client can then load a user preference file or offer a GUI to modify the color values.

This command is used by the server to identify the colors it uses to the client. This command must only be sent from the server to the client.

The color.define command takes three arguments. The first must be a non-negative integer. It is the identifier for the color. The second argument is the name of the color. This is purely decorative, and intended to be used in a client GUI for altering color value choices, so the name should be user-friendly. The third argument must be a color code or an empty string.

The server must not send multiple color.define commands with the same identifier value. Colors are defined only once per session.

The color with identifier zero (0) is the default text color and should be used by the client whenever a color is not explicitly specified by the server.

An example color definition would be IAC SB ZMP "color.define" NUL "1" NUL "Speech" NUL "0FF" NUL IAC SE. That command would define a color with the identifier 1 (one), the display name Speech, and the color code #00FFFFF (cyan).

Client should offer a means for users to view all defined colors and to change their color values. This allows the user to override the colors choices provided by the server.

color.use

Used in conjuction with color.define, the color.use command instructs the client which color to use for all further output. This command must only be sent from the server to the client.

This command takes a single argument, which must be a non-negative integer. The integer must be either zero (0) or one of the identifier values given in a previous color.define command. After receiving a color.use command, the client should render all following output with the color value of the identified color definition. If the command gave the color identifier of 0 (zero), the client should render all following output in the client's default color. The client should use the default color when told to use an undefined color.

For example, say the server sent the color definition from the example for the color.define command. Then the server sends this: IAC SB ZMP "color.use" NUL "1" NUL IAC SE. The color identifier 1 was defined by the server for Speech, with the suggested color code #0FF. The client could start using that color or another which the user chose to use for Speech content. When the client receives IAC SB ZMP "color.use" NUL "0" NUL IAC SE it would revert back to the default text color.

If the color value for a color definition was the empty string instead of an RGB value, the client must switch to the default color.

License and Copying

This document is the copyrighted work of AwesomePlay Productions, Inc.

AwesomePlay Productions, Inc. offers limited rights to recipients of this document to distribute unmodified copies of the document in electronic form, print form, or any other medium. Implementations of the protocol described in this document are wholly owned by their creators, and the implementations are not derivative works of this document and they not subject to the terms of this license.

This work is licensed under a Creative Commons License.

Creative Commons License