Script function
world.MapColour
Read about scripting
Type
Method
Summary
Changes the colour mapping - the way colours are displayed
Prototype
void MapColour(long Original, long Replacement);
View list of data type meanings
Description
You can specify a "map" of an original colour to the colour you want displayed.
The intention here is to let you override the colours sent down by MUDs, particularly using MXP colours, which are not subject to the normal ANSI colour palette.
For example, if a MUD annoys you by using a lot of red letters, you could do this:
MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))
The mapping is done at the last moment, in the output window display routine. The rest of MUSHclient will continue normally as if the colours had not changed.
You can map any number of colours, within reason. Potentially there are 16,777,216 different colours (2 to the power 24) however in practice a particular MUD is likely to only use a handful.
The colour must match *exactly* or the translation will not occur.
The arguments to the function are RGB colours (that is, numbers in the range 0 to 16,777,215) however you can use the function ColourNameToRGB as shown above if you want to use colour names.
The colour number is really made up of three bytes:
Red (low-order byte), ie. 0 to 255
Green (middle byte), ie. 0 to 255 multiplied by 256
Blue (higher-order byte), ie. 0 to 255 multiplied by 65536
To find the colour of a particular piece of text in the output window (so you can know the "from" colour) you can select it (eg. double-click) and then use the Display menu -> Text Attributes.
This will show you the Text and Background RGB colours (in HTML format). You can use those colours in the function ColourNameToRGB to translate them to numbers. eg.
x = ColourNameToRGB ("#FF00FF")
You can find the current mapping of a colour with GetMapColour, and a list of all mapped colours with MapColourList.
To make the new colours take effect immediately, call Redraw. This would only be necessary if you are changing colours "on the fly". If you are just customising colours at world startup this would not be necessary.
Available in MUSHclient version 3.54 onwards.
VBscript example
MapColour ColourNameToRGB ("red"), ColourNameToRGB ("green")
Jscript example
MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))
Lua example
MapColour (ColourNameToRGB ("red"), ColourNameToRGB ("green"))
Return value
None.
See Also ...
Topics
Colour management
Default triggers/aliases/timers/macros/colours
Functions
(AdjustColour) Adjust an RGB colour
(ANSI) Generates an ANSI colour sequence
(BoldColour) Gets/sets the RGB colour for one of the 8 ANSI bold colours
(ColourNameToRGB) Converts a named colour to a RGB colour code.
(ColourNote) Sends a message to the output window in specified colours
(ColourTell) Sends a message to the output window in specified colours - not terminated by a newline
(CustomColourBackground) Sets the RGB value for the background of a custom colour
(CustomColourText) Sets the RGB value for the text of a custom colour
(GetCustomColourName) Gets the name of a custom colour
(GetMapColour) Returns the mapping for how a particular colour will be displayed
(MapColourList) Returns an array of all the mapped colours
(NormalColour) Gets/sets the RGB colour for one of the 8 ANSI normal colours
(NoteColour) Chooses which custom colour will be used for world notes.
(NoteColourBack) Chooses which RGB colour will be used for world notes - background colour
(NoteColourFore) Chooses which RGB colour will be used for world notes - text colour
(NoteColourName) Chooses which RGB colour name will be used for world notes - text and background
(NoteColourRGB) Chooses which RGB colour will be used for world notes - text and background
(PickColour) Invokes the MUSHclient colour picker dialog
(Redraw) Schedules a redraw for all windows for this world
(RGBColourToName) Converts an RGB colour code to its equivalent name
(SetCustomColourName) Sets the name of a custom colour
(Help topic: function=MapColour)