DgsLabelGetColor

From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function gets the color of a label.

Syntax

int, int, int dgsLabelGetColor ( element theLabel [, bool notSplit = false ] )

Required Arguments

  • theLabel: The label to get color.
  • notSplit: A bool of whether the color is split into r,g,b,a or not.

Returns

If argument 'notSplit' passed is true, returns one int value, representing the color of the label if successful. false otherwise.

If argument 'notSplit' passed is false, returns three int values, representing the amount of red, green, blue if successful. false otherwise.

Example

DGS = exports.dgs
local pLabel = DGS:dgsCreateLabel( 0.5, 0.5, 0.5, 0.5, 'Text', true )
DGS:dgsLabelSetColor( pLabel, math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), 255 )

addCommandHandler( 'get_color_label', 
    function(cmd,notSplit)
        notSplit = notSplit and true or false
        if notSplit then
            local color = DGS:dgsLabelGetColor( pLabel, true )
            outputChatBox( 'Label color is '..color )
        else
            local iR, iG, iB = DGS:dgsLabelGetColor( pLabel )
            outputChatBox( ( 'Label color is r = %d, g = %d, b = %d' ):format( iR, iG, iB ) )
        end
    end
)

See Also

Custom Cursor Functions

Multi Language Supports

Animation

3D Interface

3D Line

3D Image

3D Text

Browser

Button

Check Box

Combo Box

Custom Renderer

Edit

Detect Area

Drag'N Drop

Grid List

Image

Memo

Label

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Plugin

Blur Box

Color Picker

Canvas

Circle

Effect 3D

Media Browser

Mask

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Rounded Rectangle