DgsLabelSetColor

From Multi Theft Auto: Wiki

This function allows you to set the color of a DGS label.

Syntax 1

bool dgsLabelSetColor ( element theElement, int red, int green, int blue, int alpha )

Required Arguments

  • theElement: The label to be changed.
  • red: An integer specifying the amount of red (0 to 255).
  • green: An integer specifying the amount of green (0 to 255). ( If you pass "true" into this argument, see Syntax 2. )
  • blue: An integer specifying the amount of blue (0 to 255).
  • alpha: An integer specifying the amount of alpha (0 to 255).

Returns

Returns true if the the color of the dgs label was successfully changed, false otherwise.

Syntax 2

bool dgsLabelSetColor ( element theElement, int color, bool notSplitColor )

Required Arguments

  • theElement: The label to be changed.
  • color: An integer of the color of the text of the label.
  • notSplitColor: A bool of whether the color argument is split or not. ( This argument must be true if you use this syntax! )

Returns

Returns true if the the color of the dgs label was successfully changed, false otherwise.

Example 1

This example creates a label with text "Hello World!" and sets it to a random color.

DGS = exports.dgs
local myLabel = DGS:dgsCreateLabel ( 0.45, 0.48, 0.2, 0.5, "Hello world", true )
DGS:dgsLabelSetColor ( myLabel, math.random(0, 255), math.random(0, 255), math.random(0, 255), 255 )

Example 2

This example creates a label with text "Hello World!" and sets it to a random color.

DGS = exports.dgs
local myLabel = DGS:dgsCreateLabel ( 0.45, 0.48, 0.2, 0.5, "Hello world", true )
DGS:dgsLabelSetColor ( myLabel, tocolor(math.random(0, 255), math.random(0, 255), math.random(0, 255), 255 ) ,true )

See Also

Multi Language Supports

Animation

3D Interface

3D Text

Arrow List

Browser

Button

Check Box

Combo Box

Edit

Ellipse Detect Area

Detect Area

Grid List

Image

Memo

Label

Progress Bar

Radio Button

Scroll Bar

Scroll Pane

Switch Button

Tab Panel

Window

Plugin

Media Browser

Rounded Rectangle

Color Picker

Blur Box

Effect 3D