From Arianne
Jump to navigation Jump to search

Stendhal provides two ways to modify the colors of the zone maps. One that affects the entire zone uniformly, including any entities there, and another for local effects. For both of them the coloring method is specified in the zone's xml.

As an example, int_semos_storage_-1 specifies the following for its coloring:

    <parameter name="color_method">multiply</parameter>
    <parameter name="color">#413263</parameter>
    <parameter name="blend_method">bleach</parameter>

This specifies both the zone wide, and local coloring methods.

Zone coloring mode

The following line in the Semos storage zone's definition specifies the coloring mode for the entire zone, and all entities within:

  <parameter name="color_method">multiply</parameter>

It tells the Stendhal client to use the multiply mode blending, see Blend modes for more information. For multiplication the color which everything is multiplied needs to be known too, and that is specified at the next line:

  <parameter name="color">#413263</parameter>

The color definition is the same as in html, and many programs, the GIMP for example, can display colors in that form. In the case you need to do it by hand, the numbers after # are the red, green and blue components, two for each in that order. Each component is in hexadecimal and in range 00 to ff.

Blend layers

The other zone coloring method specifies the blend modes used by the map layers blend_ground and blend_roof. The first of those is blended with all layers below the player, and the latter with the roof layer. See the map editing instructions for information about the layers. Both of the blend layers will use the same mode.


Blend modes

Coloring in Stendhal is based on blend modes. Some of the modes provided by the Stendhal client are similar to those in image manipulation programs, but some are specifically developed for the purposes of the game. All the modes, with the exception of time, can be used for both color_method and blend_method.

The exact formulas for the blend modes used by Stendhal can be found in the source file src/games/stendhal/client/gui/j2d/

Currently the client provides the following modes:


This Stendhal specific mode is used for lighting. The effect is cancelling the effect of multiply based on the lightness of the blending layer image. Also the restored light is tinted based on the color of blend layer image, so it is possible to have colored lights.

Bleach is named "bleach" in the xml, and is technically available only for zones where the general mode is multiply or time. However if the general mode is something else "bleach" will fall back to generic light, so specifying bleach mode when you want to use the blend layers for lighting is safe.

Generic light

Also a mode that is used for lights. Unlike bleach, generic light can not create colored lights, but on the other hand it works on all zones regardless of the general lighting mode, including those that have no general mode specified at all.

Generic light is turned on with "generic_light", and it also serves as a fall back mode for bleach as noted above.


Multiply is similar to a mode provided by many graphics programs. In Stendhal it is used to simulate colored lighting, that is, the normal colors on the maps correspond to white light, and multiply is used to cut out some of light, with the color components of the zone color corresponding to the amount of remaining light.

Multiply can be turned on with "multiply" in the xml. The effect depends on the zone color. This is also the method used by the time pseudo mode. If used for the blend layers the effect would depend on the blending image colors.


This is a mode often provided by image manipulation programs, and gets its name from photography. In Stendhal screen is currently only used for the twilight zone haze.

Screen can be turned on in the zone xml by the name "screen". The effect depends on the zone color, and in the case of using it for the blend layers, on the blending image colors.

Soft light

This is a mode that would be typically used in image manipulation to create shadows and highlights. In Stendhal it is currently used to tint zones where the darkening effect of multiply is not desired. It us used for example in at -1_semos_yeti_cave.

Soft light can be turned on by name "softlight" in the zone xml. The effect depends on the zone color, and in the case of using it for the blend layers, on the blending image colors.

True color

This is the blend mode that is used for coloring player outfits, but it is also available for zones to use. The effect is coloring the underlaying image with the zone color, or in the case of using the mode in blend layers, with the color of the blending image. Also the lightness of the image is bent to the direction of the brightness of the blending color, so darker blends make the image generally darker, and lighter make the image lighter. The easiest place to observe the effect is the outfit selection dialog. True color is used to create the green flames at int_magic_shrine.

True color is named "truecolor" in the xml.


Time is not an actual mode at all, but it will tell the server to specify a time dependent multiply mode for the zone, and bleach for the blend layers. This is the mode used for all the outside zones to provide them their daylight cycle.

Time can be turned on by name "time" in the zone xml. Zones using this coloring mode can not specify another mode for the blend layers, as bleach is used automatically. Also, "time" is not a valid mode for the bland layers.