DgsLabelGetColor

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

This function gets the color of a label.

Syntax

int int int dgsDxLabelGetColor ( dgs-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 true, returns one int value, representing the color of the label if successful. false otherwise.

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

Example

DGS = exports.dgs
local pLabel = DGS:dgsDxCreateLabel( 0.5, 0.5, 0.5, 0.5, 'Text', true )
DGS:dgsDxLabelSetColor( 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:dgsDxLabelGetColor( pLabel, true )
            outputChatBox( 'Label color is '..color )
        else
            local iR, iG, iB = DGS:dgsDxLabelGetColor( pLabel )
            outputChatBox( ( 'Label color is r = %d, g = %d, b = %d' ):format( iR, iG, iB ) )
        end
    end
)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows