TEXTCOLO

From ZDoom Wiki
Jump to: navigation, search

The TEXTCOLO lump is used to define custom text colors for use in hudmessages. This is especially useful when truecolor rendering is available (in an OpenGL source port or, on Windows systems, through ZDoom's use of DirectX for 2D rendering), or with wads that utilize a modified palette. Thanks to this lump, the use of cyan or magenta text, for example, is now a possibility.

Creating new colors

The format for creating new text colors is simple. Take a look at the template below. (Square brackets represent optional parameters, that you can safely omit.)

ColorName [AlternateName [OtherAlternateName [...]]]
{
	#RRGGBB  #RRGGBB  [x y]
	#RRGGBB  #RRGGBB  [x y]
	#RRGGBB  #RRGGBB  [x y]
	...
[Console:
	#RRGGBB  #RRGGBB  [x y]
	#RRGGBB  #RRGGBB  [x y]
	#RRGGBB  #RRGGBB  [x y]
	...]
[Flat:
	#RRGGBB]
}

"Color" is simply whatever name you choose, whether it be LimeGreen, DarkPurple, or NeonRainbowSmoothie. Take your pick. "#RRGGBB" specifies the color (in hex). For example, #FF0000 is bright red, #008888 would be a dark teal color, and #775522 is a rather ugly shade of brown. Notice how each #RRGGBB color definition comes in pairs of two. This is a color range. The first color in the range specifies the darkest shade that appears in the color, while the second color is the lightest. ZDoom will then use these to create a gradient between the colors. As a quick example, ZDoom's standard "Gold" translation looks like "#732B00 #FFFF73" in the new format. Keep in mind that it is possible to create odd translations as well. If you really feel the need to create an ugly green/purple gradient ("#008800 #FF00FF"), it's quite possible.

The optional x and y parameters are range specifiers and also the beginning and ending brightness indexes. ZDoom internally converts the font to a grayscale image before applying the new color, so an x value of "0" would represent the absolute darkest shade "#000000" and a y value of "255" would represent the lightest shade "#FFFFFF". These are the shades of gray, or brightness of the color, once the image is converted to gray scale. "127" is equivalent to a gray scale brightness of "#7F7F7F". These parameters are generally more useful for the console ranges, but can be used for the normal range as well.

The "Flat:" entry can be used to associate the color range to a single, specific color. This is used for example for player colors on the scoreboard.

Notes

  • "Untranslated" is a reserved word. If you try to define color ranges for this color, or to give it alternate names, you will get an error message.
  • The range specifiers, if given, must start at 0. They need to be in the [0, 255] range, and each given range must have a start larger than the previous range's end, and an end larger than their own start.
  • If there are not range specifiers, the range is assumed to begin at the previous range's end + 1 (or zero if this is the first set of range), and to end at 255. Consequently, no additional range can be given after a range without a specifier.
  • If omitted, the "Console:" entry is considered to be a range of whites.
  • Names can include spaces if they are put within quotes.

Using new colors

Thankfully, once your new colors are defined, using them is very simple. In your HudMessage or Print string, insert a \c[Color] code. For example,

   print (s:"\c[Green]Some text");

would make the text green, starting at whatever spot you choose. It is also possible to change the color in the middle of the text by inserting another \c code.

   print (s:"\c[Red]Dual \c[Blue]Colors!");

Examples

This example is designed to match the yellow Hexen font, which has a gray outline filled with shades of yellow.

Yellow
{
	#272727  #515151    0  64
	#784918  #F3A718   65 207
	#F3A82A  #FCD043  208 256
Console:
	#000000  #7F7F00    0 127
	#FFFF00  #FFFFFF  128 256
Flat:
	#EEEE33
}


This example illustrates the use of multiple names for a single color.

DarkGray DarkGrey "Dark Gray" "Dark Grey"
{
	#232323  #8B8B8B
Console:
	#000000  #646464    0 127
	#404040  #B4B4B4  128 256
Flat:
	#808080
}

Additional examples:

Teal
{
	#004444  #00AAAA
 Console:
	#000000  #007F7F    0 127
	#00FFFF  #DEFFFF  128 256
}
ZenGreen
{
	#004400  #00FF00
Console:
	#000000  #007F00    0 127
	#00FF00  #FEFFFE  128 256
}

Default colors

ZDoom comes equipped with quite a few default translation ranges. Simply use these colors in hudmessages the same as mentioned above.

Color name Color range Console range Color name Color range Console range Color name Color range Console range
██ Black ██ DarkGray / DarkGrey / "Dark Gray" / "Dark Grey" ██ Olive
██ Blue ██ DarkGreen / "Dark Green" ██ Orange
██ Brick ██ DarkRed / "Dark Red" ██ Purple
██ Brown ██ Gold ██ Red
██ Cream ██ Gray / Grey ██ Tan
██ Cyan ██ Green ██ White
██ DarkBrown / "Dark Brown" ██ LightBlue / "Light Blue" ██ Yellow
  • Untranslated

See also