<!-- fivemad.com, Markdown source of https://fivemad.com/docs/tools/text-colors -->
> Source: https://fivemad.com/docs/tools/text-colors
> Section: Tools
> Tags: text colours, DrawText, notifications, help text, chat colours
> Tool: https://fivemad.com/tools/text-colors
> Last updated: 2026-09-25
> Site map for assistants: https://fivemad.com/llms.txt

# Draw Text Colors

Preview GTA V tilde colour and formatting codes live in DrawText, notifications and help text, and FiveM chat caret codes, with ready Lua snippets.

Draw Text Colors lets you type a string with GTA V formatting codes (`~r~`, `~h~`, `~n~`, `~INPUT_CONTEXT~` and friends) and see how it looks as on-screen text, a feed notification or a help text box. A second section does the same for the caret codes (`^1`, `^*`) of the FiveM chat. Every preview comes with a Lua snippet.

Every snippet block on this page has a **Lua / JS / TS / C#** switcher in its corner. The choice is remembered across the site, and [the runtimes page](/docs/development/runtimes) explains what changes between them.

## What it is for

Testing text formatting in game means a restart or a resource reload for every tweak. Here you see the colours, bold parts, line breaks and key prompts as you type, then copy code that draws the same thing with the right natives.

## Quick start

1. Type in the **Text** box. The page starts with a sample that uses colours, a key prompt, a `~a~` name and a `~1~` number.
2. Click the colour buttons under the box (or any card in **Reference**) to insert a code at the cursor.
3. Pick the output style with the tabs above the preview: **DrawText**, **Notification** or **Help text**.
4. If your text has `~a~` or `~1~`, fill the value fields that appear under the text box.
5. Copy `drawtext.lua`, `notify.lua` or `helptext.lua`.

The preview uses system fonts in place of the game fonts, so it is close but not pixel exact.

## Tilde codes

| Code | Result | Colour |
| --- | --- | --- |
| `~r~` | Red | #E03232 |
| `~b~` | Blue | #5DB6E5 |
| `~g~` | Green | #72CC72 |
| `~y~` | Yellow | #F0C850 |
| `~p~` | Purple | #8466E2 |
| `~q~` | Pink | #CB3694 |
| `~o~` | Orange | #FF8555 |
| `~c~` | Grey | #8C8C8C |
| `~m~` | Dark grey | #646464 |
| `~u~` | Black | #000000 |
| `~l~` | Black | #000000 |
| `~d~` | Dark blue | #2F5C73 |
| `~f~` | Friendly blue | #5DB6E5 |
| `~w~` | White | #F0F0F0 |
| `~s~` | Back to the default colour | set by `SetTextColour` |
| `~h~` | Bold on / off | |
| `~bold~` | Bold on / off (newer builds) | |
| `~italic~` | Italic on / off (newer builds) | |
| `~n~` | New line | |
| `~a~` | String placeholder, filled by `AddTextComponentSubstringPlayerName` | |
| `~1~` | Integer placeholder, filled by `AddTextComponentInteger` | |
| `~ws~` | Wanted star icon | |
| `~EX_R*~` | Rockstar logo | |

A colour stays active until the next colour code. The **HUD colours** tab lists 32 `~HUD_COLOUR_NAME~` tokens (for example `~HUD_COLOUR_FREEMODE~`, `~HUD_COLOUR_REDLIGHT~`) with their RGB values, and they work inline the same way.

The **Buttons** tab lists `~INPUT_*~` tokens such as `~INPUT_CONTEXT~`, `~INPUT_ENTER~`, `~INPUT_DETONATE~` and `~INPUTGROUP_MOVE~`. In game they render the key the player has bound (or the pad button), so a prompt stays correct on custom bindings. The preview shows the default keyboard key.

## DrawText options

Shown only on the **DrawText** tab:

| Option | What it does | Default |
| --- | --- | --- |
| **Font** | 0 Chalet London, 1 House Script, 2 Monospace, 4 Chalet Comprime, 7 Pricedown | 4 |
| **Scale** | 0.2 to 1.2, written as `SetTextScale(0.0, scale)` | 0.5 |
| **Colour** / **Alpha** | Base colour for `SetTextColour`, and what `~s~` returns to | white, 255 |
| **X (0 to 1)** / **Y (0 to 1)** | Screen position for `EndTextCommandDisplayText` | 0.5 / 0.8 |
| **Outline** | Adds `SetTextOutline()` | on |
| **Drop shadow** | Adds `SetTextDropShadow()` | off |
| **Centre** | Adds `SetTextCentre(true)` | on |

## Snippets

DrawText is drawn every frame inside a thread:

```lua title="drawtext.lua"
CreateThread(function()
    while true do
        Wait(0)
        SetTextFont(4)
        SetTextScale(0.0, 0.5)
        SetTextColour(255, 255, 255, 255)
        SetTextOutline()
        SetTextCentre(true)
        BeginTextCommandDisplayText("STRING")
        AddTextComponentSubstringPlayerName("~b~Mission~s~ started.")
        EndTextCommandDisplayText(0.5, 0.8)
    end
end)
```

A notification is a single call:

```lua title="notify.lua"
BeginTextCommandThefeedPost("STRING")
AddTextComponentSubstringPlayerName("~g~Saved~s~ your outfit.")
EndTextCommandThefeedPostTicker(false, true)
```

Help text has to be called every frame while it should stay up:

```lua title="helptext.lua"
BeginTextCommandDisplayHelp("STRING")
AddTextComponentSubstringPlayerName("Press ~INPUT_CONTEXT~ to open the shop")
EndTextCommandDisplayHelp(0, false, true, -1)
```

When the text contains `~a~` or `~1~`, the snippet registers it with `AddTextEntry("FIVEMAD_TEXT", ...)` and adds one component per placeholder, in order, with the values you typed.

> [!NOTE]
> One `AddTextComponentSubstringPlayerName` is cut at 99 characters. For longer text without placeholders, the snippet switches to the built-in `CELL_EMAIL_BCON` entry and splits your text into chunks of up to 99 characters without breaking a `~code~` in half.

## FiveM chat colours

The default chat resource does not read tilde codes. It uses caret codes:

| Code | Result |
| --- | --- |
| `^0` | White |
| `^1` | Red |
| `^2` | Green |
| `^3` | Yellow |
| `^4` | Blue |
| `^5` | Light blue |
| `^6` | Purple |
| `^7` | White |
| `^8` | Orange red |
| `^9` | Grey |
| `^*` | Bold |
| `^_` | Underline |
| `^~` | Strikethrough |
| `^=` | Underline and strikethrough |
| `^r` | Reset |

Type an **Author** and **Text**, click the colour swatches (which also copy the code) or format buttons, and copy `chat.lua`:

```lua title="chat.lua"
TriggerEvent("chat:addMessage", {
    color = { 255, 255, 255 },
    multiline = true,
    args = { "Dispatch", "^1[Police]^0 Suspect spotted near ^3Legion Square^0." }
})
```

The colours shown are the stock chat stylesheet defaults. A custom chat theme can change them.

## Common mistakes

- Using `~r~` in chat messages or `^1` in DrawText. They do not mix.
- Forgetting `~s~` after a coloured word, so the rest of the line stays coloured.
- Showing help text once. It disappears the next frame unless you call it in a loop.

## Related tools

- [Controls Reference](/docs/tools/controls-reference)
- [Warning Screen Buttons](/docs/tools/warning-buttons)
- [Blip, Marker & Checkpoint Browser](/docs/tools/blip-marker-browser)
- [Scaleform Functions](/docs/tools/scaleform-reference)
