ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. tocolor

Function

tocolor

Server and clientMiscellaneousIdentical to MTA:SA

Packs a colour from four components into one ARGB number used by the dx functions.

Syntax

int tocolor(int red, int green, int blue [, int alpha = 255])

Arguments

redint
Red 0-255.
greenint
Green 0-255.
blueint
Blue 0-255.
alphaint, optional = 255
Opacity 0-255.

Returns

An ARGB colour.

Example

local orange = tocolor(255, 122, 34, 200)
addEventHandler("onClientRender", root, function()
    dxDrawRectangle(20, 20, 200, 40, orange)
end)

See also