Grand opening25% off everything with FAM-261023-261025-UL4B9this weekendAdded for you at checkout Halloween Edition36 maps, limited runlimited runShop the drop

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.

Try
As the game draws it

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.

38 of 38

  • ~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 textBeginTextCommandDisplayText("STRING") → DrawText

    Colour 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 practiceNotificationsBeginTextCommandThefeedPost("STRING") → EndTextCommandThefeedPostTicker

    The 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 textBeginTextCommandDisplayHelp("STRING") → EndTextCommandDisplayHelp

    Colour 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.

  • documentedSubtitlesBeginTextCommandPrint("STRING") → EndTextCommandPrint

    The 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 namesBeginTextCommandSetBlipName("STRING") → EndTextCommandSetBlipName

    Often 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 chatSendNUIMessage, the chat resource

    No. 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.

DrawText with colour codes

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)
Notification and help text

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?
They are tilde codes the game reads inside a text label: ~r~ for red, ~b~ for blue, ~g~ for green, ~y~ for yellow, ~o~ for orange, ~p~ for purple, ~q~ for pink, ~c~ and ~t~ for grey, ~m~ for a darker grey, ~d~ for dark blue, ~l~ for black, ~w~ for white, ~f~ for the alternate friendly blue, ~v~ and ~u~ for two colours a script sets itself, and ~s~ to go back to the default. A colour code applies to everything after it until the next colour code or ~s~.
Is ~h~ a colour?
No, and this is the single most common misunderstanding about these codes. ~h~ turns bold on and a second ~h~ turns it off — it is a toggle, like ~italic~. It looks like a colour because bold white next to normal white reads as brighter, so people write ~h~~r~ and conclude ~h~ made a different red. It did not: it made the same red bold. ~bold~ is an alias for the same toggle.
Why do ~r~ and the other codes show up as plain text in my chat or NUI?
Because NUI is a browser. A tilde code only means something to the game’s own text renderer, and the default FiveM chat resource is an NUI window, so ~r~ arrives there as three literal characters and is printed as such. Colour NUI with HTML and CSS, or use whatever colour support your chat resource provides. The same applies to anything you draw yourself in a React or HTML overlay.
Can I change what ~r~ actually looks like?
Yes. Each colour code resolves to an entry in the HUD colour table, and the table is replaceable at runtime with ReplaceHudColour or ReplaceHudColourWithRgba. So ~r~ is HUD_COLOUR_RED, index 6, and whatever that index currently holds is what gets drawn. The swatches on this page are the values the game ships with, which means a server that has restyled its HUD will not match them.
How many colours can I actually use?
There are 16 single-letter colour codes, but you are not limited to them. ~HUD_COLOUR_NAME~ reaches any entry in the HUD colour table by name, ~HC_NAME~ is the same thing abbreviated, and ~HC_13~ reaches one by index. That opens up the whole table rather than the handful with letters, which is the usual answer to "there is no good orange". The preview on this page only carries the 16 indexes the letter codes use, so a name or index outside that set shows as an unknown code here even though the game resolves it — the full table is on the HUD colours reference.