FREE TOOL · text formatting codes
FiveM text colours
Type a label string and watch it render. Every colour code, every line break, bold and italics, drawn here the way the game will draw them — so you can get a two-line notification right before you reload the resource rather than after the fourth try.
38 codes in all, 17 of them colours. The codes and their descriptions come from the FiveM docs — Text formatting reference; the hex values are the stock HUD colours from the FiveM docs — HUD colors table, which a server can replace at runtime.
WANTED — Vinewood Blvd
A browser is not the game: the font is the HUD font’s nearest web equivalent, and a key prompt or a blip glyph is drawn here as a labelled box because only the running game knows which key is bound.
- ~r~HUD_COLOUR_RED · 6 · #e03232
Red. The game uses it for enemy characters and vehicles, and it is the default choice for a failure or a warning line.
- ~g~HUD_COLOUR_GREEN · 18 · #72cc72
Green. Used for pickup-type objectives in the base game; on a server it usually means success.
- ~b~HUD_COLOUR_BLUE · 9 · #5db6e5
Blue, and lighter than people expect — used for friendly characters and vehicles.
- ~f~HUD_COLOUR_FRIENDLY · 118 · #5db6e5
The rare alternate friendly colour. The stock value is identical to ~b~, so on an unmodified server the two look the same.
- ~y~HUD_COLOUR_YELLOW · 12 · #f0c850
Yellow. The game uses it for destination names, which is why it reads as "go here" rather than "careful".
- ~o~HUD_COLOUR_ORANGE · 15 · #ff8555
Orange. Documented as a team colour indicator.
- ~p~HUD_COLOUR_PURPLE · 21 · #8466e2
Purple. Also a team colour indicator.
- ~q~HUD_COLOUR_PINK · 24 · #cb3694
Pink. Added for Arena War, and the only strong magenta in the set.
- ~c~HUD_COLOUR_MENU_GREY · 67 · #8c8c8c
Grey. Subtitles use it to de-emphasise a character who is off screen.
- ~t~HUD_COLOUR_MENU_GREY · 67 · #8c8c8c
The same grey as ~c~. Subtitles use it for speech in another language.
- ~m~HUD_COLOUR_MID_GREY_MP · 74 · #646464
A darker mid grey — the "silver" tier colour, and dim enough to disappear on a dark background.
- ~l~HUD_COLOUR_BLACK · 2 · #000000
Black. There when nothing else will give you black; invisible on almost every HUD, so it is for light backgrounds only.
- ~d~HUD_COLOUR_BLUEDARK · 11 · #2f5c73
Dark desaturated blue. Marks a team objective already held by a player.
- ~w~HUD_COLOUR_WHITE · 1 · #f0f0f0
White — and not quite pure white. Use it together with ~s~ to get back to normal text.
- ~v~HUD_COLOUR_SCRIPT_VARIABLE · 128 · #000000
A slot your script fills with SetScriptVariableHudColour. Black until you set it, which is why an unset ~v~ looks like nothing rendered.
Black until a script sets it — the swatch is the stock value, not a usable colour.
- ~u~HUD_COLOUR_SCRIPT_VARIABLE_2 · 165 · #000000
The second script-set slot. Same story as ~v~: black by default.
Black until a script sets it — the swatch is the stock value, not a usable colour.
- ~s~
Resets the colour to whatever the current context considers default. Not a colour of its own — a return to the baseline.
- ~n~
A line break. The nearest thing to <br> the game text system has.
- ~h~
Bold on. It is a toggle, not a colour — use it a second time to turn bold back off. This is the one people mistake for a colour, usually because ~h~~r~ looks different from ~r~ alone.
- ~bold~
An alias of ~h~, with the same toggle behaviour.
- ~italic~
Italic on, and off again on the second use.
- ~ws~
A wanted star glyph.
- ~wanted_star~
The long form of ~ws~, identical in effect.
- ~nrt~
No Return Top. Behaves much like ~n~; the documentation gives it no further description, so test it where you need it.
- ~EX_R*~
The Rockstar logo, in the fonts that carry the glyph.
- <C></C>
Condensed text. Normally used for gamer tags; note that it is an angle-bracket tag rather than a tilde code.
- ~BLIP_name~
Draws the named blip inline. Documented for help messages and other supported contexts, so it is not something to rely on in arbitrary text.
- ~a~
A placeholder for a string component — the slot AddTextComponentSubstringPlayerName and friends fill in.
- ~1~
A placeholder for a number component, filled by AddTextComponentInteger.
- ~a_1~
A numbered string placeholder, so a translation can take the components in a different order from the English.
- ~1_1~
The same idea for numeric components.
- ~x~
Undocumented beyond "related to subtitles". The reference itself says unknown, so this page does not pretend otherwise.
- ~z~
At the very start of a string, hides the whole string when the player has subtitles switched off.
- ~INPUT_name~
Shows the key currently bound to a control — ~INPUT_CONTEXT~ renders as E on a keyboard and as the pad button on a controller. Help messages are its home.
- ~INPUTGROUP_name~
The same for a control group rather than a single control.
- ~ACCEPT~
The accept button for the active input device.
- ~CANCEL~
The cancel button for the active input device.
- ~PAD_A~
One of roughly fifty gamepad glyph codes — ~PAD_A~, ~PAD_DPAD_UP~, ~PAD_RSTICK_ROTATE~ and the rest. Each draws a controller button in supported contexts.
Click a swatch to append that code to the box above.
WHERE THEY WORK
And where they quietly do not
The reference documents the codes for game text labels in general and does not list the contexts, so this table says where each claim comes from. Anything we have not confirmed ourselves is labelled as such — a page that tells you blip names accept colour codes without having tried it costs you more time than one that admits it does not know.
- observed in practiceOn-screen text
BeginTextCommandDisplayText("STRING") → DrawTextColour codes, ~n~, ~h~ and ~italic~ all take effect. This is the case every "fivem DrawText colors" search is about. The documentation describes the codes for game text labels generally and does not name DrawText, so this is from practice rather than a published statement.
- observed in practiceNotifications
BeginTextCommandThefeedPost("STRING") → EndTextCommandThefeedPostTickerThe same codes work in the feed at the top left, including ~n~ for a second line. The feed clips long strings, so a ~n~ is usually better than a long single line.
- documentedHelp text
BeginTextCommandDisplayHelp("STRING") → EndTextCommandDisplayHelpColour and formatting codes work, and this is the context the reference explicitly names for ~INPUT_...~ and ~BLIP_...~ — a help prompt is where a key glyph belongs.
- documentedSubtitles
BeginTextCommandPrint("STRING") → EndTextCommandPrintThe grey codes ~c~ and ~t~ exist for subtitles specifically, and ~z~ hides a subtitle string when the player has subtitles off.
- not verified by usBlip names
BeginTextCommandSetBlipName("STRING") → EndTextCommandSetBlipNameOften asked, rarely tested properly. We have not confirmed either way on a current build, so this page will not tell you it works. Test it with one blip before you colour fifty, and expect the pause-map list to be stricter than the minimap label.
- does not workNUI and chat
SendNUIMessage, the chat resourceNo. NUI is a browser — a tilde code is just text there, and it shows up literally. The default FiveM chat is NUI too, so ~r~ in a chat message prints as the four characters ~r~. Use HTML or the chat resource’s own colour support instead.
HOW TO USE IT
The Lua, with the codes in the right place
The codes live inside the string, not in a native argument. That is worth saying because SetTextColour also exists: it sets the base colour for the whole draw, and a colour code inside the string overrides it from the point where it appears. ~s~ returns to that base — so if your ~s~ comes out grey rather than white, the base colour is what to look at.
Client-side, inside a per-frame loop. On-screen text is drawn every frame; the string is rebuilt every frame with it, so keep it simple.
-- DrawText, with the colour codes in the string rather than in SetTextColour.
-- SetTextColour sets the base colour; the codes override it from where they appear.
local function drawTxt(text, x, y, scale)
SetTextFont(4)
SetTextScale(scale, scale)
SetTextColour(240, 240, 240, 255) -- what ~s~ returns to
SetTextOutline()
SetTextCentre(true)
BeginTextCommandDisplayText("STRING")
AddTextComponentSubstringPlayerName(text)
EndTextCommandDisplayText(x, y)
end
CreateThread(function()
while true do
Wait(0)
-- Drawn every frame. ~n~ breaks the line, ~h~ toggles bold off again.
drawTxt("~h~~r~RESTRICTED AREA~h~~s~~n~~w~Turn back", 0.5, 0.42, 0.5)
end
end)Client-side, and not in a loop. The feed and the help prompt are fire-and-forget.
-- A notification. Same codes, no loop -- the feed draws it once.
local function notify(msg)
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName(msg)
EndTextCommandThefeedPostTicker(false, true)
end
notify("~g~Paid~s~ ~y~$1,250~s~ into your account")
-- Help text is where ~INPUT_~ belongs: the game swaps in the real key.
local function help(msg)
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName(msg)
EndTextCommandDisplayHelp(0, false, true, -1)
end
help("Press ~INPUT_CONTEXT~ to ~b~board~s~ the bus")QUESTIONS
About the text formatting codes
What are the FiveM text colour codes?
Is ~h~ a colour?
Why do ~r~ and the other codes show up as plain text in my chat or NUI?
Can I change what ~r~ actually looks like?
How many colours can I actually use?
MORE
Next to this one
Every DrawMarker type and every checkpoint type, with the call ready to copy.
Hash calculatorGetHashKey as you type, signed and unsigned and hex at once.
Blip sprites and coloursEvery sprite id with the picture it draws, and the colour indexes beside them.
All the free toolsThe flag calculators, the animation and cutscene lists, the interactive map.
ALSO FREE
Tools that go with this one
Picked because they touch the same files, natives or part of the game.