====== setColor ======
~~NOTOC~~
[[developer_center:developer_editor:script:ui_event|From Customui Class]]
Customui:setColor(playerid, uiid, elementid, color)
**API Description**
Changes the color of a UI text element.
^ Parameters ^ Types ^ Info ^
| playerid | number | Player ID |
| uiid | string | Custom UI ID |
| elementid | string | Text element ID |
| color | string | 6-digit hex color (RRGGBB) |
^ Return Value ^ Type ^
| ErrorCode.OK (0) | number |
==== Examples ====
-- Triggered when player clicks a block
local function clickblock(event)
local playerid = event.eventobjid -- Clicking player's ID
local uiid = "6986982063319417057" -- Replace with your UI ID
local elementid = "6986982063319417057_1" -- Replace with text element ID
local color = 0xff0000 -- Red color (RRGGBB format)
-- Change the text element color
Customui:setColor(playerid, uiid, elementid, color)
end
ScriptSupportEvent:registerEvent([=[Player.ClickBlock]=], clickblock)
----
==== Color Format Details ====
=== Supported Formats ===
* 0xRRGGBB (6-digit hex)
=== Common Color Values ===
| Color | Hex Value |
| Red | 0xff0000 |
| Green | 0x00ff00 |
| Blue | 0x0000ff |
| White | 0xffffff |
| Black | 0x000000 |
----
==== Advanced Usage ====
====Dynamic Coloring**====
local colors = {"0xFF0000", "0x00FF00", "0x0000FF"} -- Color cycle
local current = 1
Customui:setColor(playerid, uiid, elementid, colors[current])
current = (current % #colors) + 1 -- Rotate colors