Color Codes Guide¶
Console Color Codes¶
Use these codes in server console output and logging:
| Code | Color | Preview |
|---|---|---|
^0 |
Reset | - |
^1 |
Red | |
^2 |
Green | |
^3 |
Yellow | |
^4 |
Blue | |
^5 |
Light Blue | |
^6 |
Purple | |
^7 |
White | |
^8 |
Gray | |
^9 |
Pink |
Example:
print("^2[SUCCESS]^0 Player loaded successfully")
print("^1[ERROR]^0 Failed to connect to database")
Notification Color Codes¶
Use these codes in notifications to format text with colors and styles.
Notification Functions¶
Server-side:
cv.notify(id, title, description, type, time)
cv.notifyCustom(id, title, description, type, time, icon)
Client-side:
Parameters:
- id (server only): Player server ID
- title: Notification title text
- description: Main notification message (supports color codes)
- type: Notification type ('success', 'error', 'info', 'warn')
- time: Duration in milliseconds (optional)
- icon: Custom icon name (only for notifyCustom)
Color Formatting¶
| Code | Color | Preview | Usage |
|---|---|---|---|
~r~text~s~ |
Red | Error states, warnings | |
~g~text~s~ |
Green | Success messages | |
~b~text~s~ |
Blue | Information | |
~y~text~s~ |
Yellow | Warnings, cautions | |
~p~text~s~ |
Purple | Special actions | |
~c~text~s~ |
Cyan | Hints, tips | |
~o~text~s~ |
Orange | Alerts | |
~w~text~s~ |
White | Default text |
Example:
-- Server-side
cv.notify(source, 'Success!', '~g~Your vehicle~s~ has been ~h~spawned~s~', 'success', 5000)
-- Client-side
cv.notify('Success!', '~g~Your vehicle~s~ has been ~h~spawned~s~', 'success', 5000)
Highlight Colors¶
The ~h~text~s~ code applies highlighting based on notification type:
| Notification Type | Highlight Color | Preview |
|---|---|---|
success |
Green | |
error |
Red | |
info |
Teal | |
warn |
Yellow |
Example:
-- Server-side
cv.notify(source, 'Payment', 'Amount: ~h~$5000~s~', 'success', 5000)
-- Client-side
cv.notify('Payment', 'Amount: ~h~$5000~s~', 'success', 5000)
Text Styling¶
| Code | Effect | Preview |
|---|---|---|
~bold~text~s~ |
Bold text | Example Text |
~extra-bold~text~s~ |
Extra bold text | Example Text |
~italic~text~s~ |
Italic text | Example Text |
~pulse~text~s~ |
Animated pulsing effect | ✨ Animated |
Example:
-- Server-side
cv.notify(source, 'Warning', '~bold~Warning:~s~ Low health detected', 'warn', 5000)
-- Client-side
cv.notify('Warning', '~bold~Warning:~s~ Low health detected', 'warn', 5000)
Special Formatting¶
Line Breaks¶
Use ~n~ to create line breaks:
-- Server-side
cv.notify(source, 'Multi-line', 'First line~n~Second line~n~Third line', 'info', 5000)
-- Client-side
cv.notify('Multi-line', 'First line~n~Second line~n~Third line', 'info', 5000)
Input Keys¶
Use ~INPUT~KEY~s~ to display keyboard/controller buttons:
-- Server-side
cv.notify(source, 'Interaction', 'Press ~INPUT~E~s~ to interact', 'info', 5000)
-- Client-side
cv.notify('Interaction', 'Press ~INPUT~E~s~ to interact', 'info', 5000)
Complete Examples¶
Success Notification¶
-- Server-side
cv.notify(source, 'Job Complete', '~g~Job Complete!~s~~n~You earned ~h~$2500~s~', 'success', 5000)
-- Client-side
cv.notify('Job Complete', '~g~Job Complete!~s~~n~You earned ~h~$2500~s~', 'success', 5000)
Error with Multiple Colors¶
-- Server-side
cv.notify(source, 'Payment Failed', '~r~Payment Failed!~s~~n~Insufficient funds: ~y~$500~s~ required', 'error', 5000)
-- Client-side
cv.notify('Payment Failed', '~r~Payment Failed!~s~~n~Insufficient funds: ~y~$500~s~ required', 'error', 5000)
Interactive Prompt¶
-- Server-side
cv.notify(source, 'Vehicle Nearby', '~c~Vehicle nearby~s~~n~Press ~INPUT~E~s~ to ~bold~enter~s~', 'info', 5000)
-- Client-side
cv.notify('Vehicle Nearby', '~c~Vehicle nearby~s~~n~Press ~INPUT~E~s~ to ~bold~enter~s~', 'info', 5000)
Styled Warning¶
-- Server-side
cv.notify(source, 'Server Restart', '~pulse~~o~ATTENTION~s~~n~~italic~Server restart in ~h~5 minutes~s~', 'warn', 10000)
-- Client-side
cv.notify('Server Restart', '~pulse~~o~ATTENTION~s~~n~~italic~Server restart in ~h~5 minutes~s~', 'warn', 10000)
Custom Notification with Icon¶
-- Server-side
cv.notifyCustom(source, 'Achievement', '~g~Achievement Unlocked!~s~~n~First vehicle purchased', 'success', 5000, 'car')
-- Client-side
cv.notifyCustom('Achievement', '~g~Achievement Unlocked!~s~~n~First vehicle purchased', 'success', 5000, 'car')
Note: You can use any icon name from Iconify's icon sets for the icon parameter.