natives.setTextDropshadow

Function Client Only icon-iv.png Online and Offline

Available since Client 1.0.0

void natives.setTextDropshadow(bool enable, int r, int g, int b, int a)

The natives.setTextDropshadow function is used to Enables or disables a coloured dropshadow behind text drawn on the screen.

Parameters

1) bool enable True to enable dropshadow effect, false to disable.
2) int r Red component of the shadow colour (0–255).
3) int g Green component of the shadow colour (0–255).
4) int b Blue component of the shadow colour (0–255).
5) int a Alpha component (opacity) of the shadow colour (0–255).

Return

void This function doesn't return a value.

Notes

  • - Must be called before natives.displayTextWithLiteralString or similar text drawing functions- The dropshadow improves readability by adding a coloured shadow offset behind the text- Alpha controls the opacity of the shadow; 255 = fully visible, 0 = invisible- Can be combined with natives.setTextEdge for stronger contrast.

Examples

Example 1 - JavaScript:

addEventHandler("OnDrawnHUD", function() {

   // White text with a black dropshadow
   natives.setTextScale(0.30, 0.30);
   natives.setTextFont(0);
   natives.setTextColour(255, 255, 255, 255);
   natives.setTextDropshadow(true, 0, 0, 0, 200);
   natives.displayTextWithLiteralString(new Vec2(0.05, 0.15), "STRING", "Text with black shadow");

});

Compatibility

There isn't any compatibility information for this function.