DgsLabelGetColor

From Multi Theft Auto: Wiki
Revision as of 08:03, 11 July 2019 by Thisdp (talk | contribs) (→‎Syntax)
Jump to navigation Jump to search

This function gets the color of a label.

Syntax

int, int, int dgsLabelGetColor ( 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 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 Element

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

Menu

Label

Layout

Line

Progress Bar

Radio Button

Scale Pane

Scroll Bar

Scroll Pane

Selector

Style

Switch Button

Tab Panel

Window

Basic Shape Plugins

Circle

Quadrilateral

Rounded Rectangle

Other Plugins

Blur Box

Canvas

Chart

Color Picker

Effect 3D

Gradient

Mask

Media Browser

Nine Slice

Object Preview Supports

Paste Handler

QRCode

Remote Image

Screen Source

SVG

Tooltips