Phaser API Documentation

Only webGL setWordTint(word, [count], [tintFill], [topLeft], [topRight], [bottomLeft], [bottomRight])


Sets a tint on a matching word within this Bitmap Text.

The word parameter can be either a string or a number.

If a string, it will run a string comparison against the text contents, and if matching, it will tint the whole word.

If a number, if till that word, based on its offset within the text contents.

The count parameter controls how many words are replaced. Pass in -1 to replace them all.

This parameter is ignored if you pass a number as the word to be searched for.

This is a WebGL only feature and only works with Static Bitmap Text, not Dynamic.

The tint works by taking the pixel color values from the Bitmap Text texture, and then multiplying it by the color value of the tint. You can provide either one color value, in which case the whole character will be tinted in that color. Or you can provide a color per corner. The colors are blended together across the extent of the character range.

To swap this from being an additive tint to a fill based tint, set the tintFill parameter to true.

To modify the tint color once set, call this method again with new color values.

Using setCharacterTint can override tints set by this function, and vice versa.


name type arguments Default description
word string | number

The word to search for. Either a string, or an index of the word in the words array.

count number <optional> 1

The number of matching words to tint. Pass -1 to tint all matching words.

tintFill boolean <optional> false

Use a fill-based tint (true), or an additive tint (false)

topLeft number <optional> 0xffffff

The tint being applied to the top-left of the word. If not other values are given this value is applied evenly, tinting the whole word.

topRight number <optional>

The tint being applied to the top-right of the word.

bottomLeft number <optional>

The tint being applied to the bottom-left of the word.

bottomRight number <optional>

The tint being applied to the bottom-right of the word.


This BitmapText Object.