Zum Inhalt

Color Codes Guide

Console Color Codes

Use these codes in server console output and logging:

Code Color Preview
^0 Reset -
^1 Red red
^2 Green green
^3 Yellow yellow
^4 Blue blue
^5 Light Blue light blue
^6 Purple purple
^7 White white
^8 Gray gray
^9 Pink 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:

cv.notify(title, description, type, time)
cv.notifyCustom(title, description, type, time, icon)

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 red Error states, warnings
~g~text~s~ Green green Success messages
~b~text~s~ Blue blue Information
~y~text~s~ Yellow yellow Warnings, cautions
~p~text~s~ Purple purple Special actions
~c~text~s~ Cyan cyan Hints, tips
~o~text~s~ Orange orange Alerts
~w~text~s~ White 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 green
error Red red
info Teal teal
warn Yellow 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)
This renders the key in a styled button format.


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.