tocolor
Client-side
Server-side
Shared
This page is incomplete! Help wanted!
Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.
This function retrieves the hex number of a specified color, useful for the dx functions. Added server-side.
Syntax
tocolor ( )Code Examples
server
This example displays the text "Tuna" in small at the top left side of your screen. The color of this text can be changed using the command /tunaColor.
local tunaColor = tocolor(255, 0, 0, 255) -- Default color
-- This function draws the textlocal function drawTuna() dxDrawText("Tuna", 5, 5, 100, 100, tunaColor)endaddEventHandler("onClientRender", root, drawTuna)
--This function handles the /tunaColor command, allowing players to set the color of tunalocal function tunaColorCommand(command, red, green, blue, alpha) red, green, blue, alpha = tonumber(red), tonumber(green), tonumber(blue), tonumber(alpha) -- Convert all the args to numbers. NOTE: tonumber will return false if the arg is not provided/is not valid.
-- Remind the user of the proper syntax if they failed to provide all the args if not red or not green or not blue then outputChatBox("* USAGE: /tunaColor [red] [green] [blue] [alpha]", 255, 0, 0) return end
-- Make the alpha arg optional if not alpha then alpha = 255 end
-- Update the color tunaColor = tocolor(red, green, blue, alpha)endaddCommandHandler("tunaColor", tunaColorCommand)-- Example /setcoloroftuna 255 0 0 255 - for red.See Also
Utility Functions
- addDebugHook
- bitAnd
- bitArShift
- bitExtract
- bitLRotate
- bitLShift
- bitNot
- bitOr
- bitReplace
- bitRRotate
- bitRShift
- bitTest
- bitXor
- createTrayNotification
- debugSleep
- decodeString
- deref
- downloadFile
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getFPSLimit
- getKeyboardLayout
- getLocalization
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getProcessMemoryStats
- getRealTime
- getServerIp
- getTickCount
- getTimerDetails
- getTimers
- gettok
- getUserdataType
- getVersion
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isShowCollisionsEnabled
- isShowSoundEnabled
- isTimer
- isTimerPaused
- isTransferBoxAlwaysVisible
- isTransferBoxVisible
- isTrayNotificationEnabled
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- ref
- removeDebugHook
- resetTimer
- setClipboard
- setDevelopmentMode
- setFPSLimit
- setTimer
- setTimerPaused
- setTransferBoxVisible
- setWindowFlashing
- sha256
- showCol
- showSound
- split
- teaDecode
- teaEncode
- tocolor
- toJSON
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub