Manual:DIL Manual/getcolor()

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:03, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

getcolor()

Function (string). Returns the HTML tag that starts text in a named colour.

getcolor(key : string)

Returns <div class='key'>, nothing more: it is a short way to write the tag. Text inside it is shown in the reader's colour for key. For a telnet player that is the colour they chose with the color command, or one a DIL gave them with addcolor(), and otherwise the game's default from vme/etc/color.def (default, say_self, clan, ...). The web client gets the class as it is and colours it with its own style sheet.

Parameters

Name Type Meaning
key string The colour's name, the class of the div.

Returns

String: <div class='key'>. A string variable that was never set gives <div class=>.

Notes

  • It does not read a player's colours, and it takes no unit: the old manual's
 getcolor(ch, key) doesn't compile.
  • Close the colour with </div>.

Example

dilbegin clan_tell(pc : unitptr, msg : string);
code
{
   sendtext(getcolor("clan") + msg + "</div><br/>", pc);
   quit;
}
dilend

Sends a line in the reader's clan colour, the same as writing <div class='clan'> as clans.zon does.

See also