- Creating custom type
- Modifying the location
- Modifying the corners
- Custom background and text color
- Custom divider line
- Glowing effect
- Modifying the height and width
- Modifying Icons
- Other Settings
You can create custom types of notifications!
To create custom notification types, open the web/index.js
file and find the following code:
const actionStyles = {
success: { color: '#00ff37', image: '../img/success.png' },
error: { color: '#ff0000', image: '../img/error.png' },
info: { color: '#0059ff', image: '../img/info.png' },
warning: { color: '#ff8800', image: '../img/warning.png' },
general: { color: '#aaaaaa', image: '../img/general.png' },
sms: { color: '#42b387', image: '../img/sms.png' },
};
Now, use the following template to create your custom notification type:
- name: This is the notification type name! Avoid using single quotes (
'
), double quotes ("
), or backticks (`
). - color: This is the color of the custom type! You can use HEX or RGB formats (e.g.,
'rgb(0, 0, 0)'
). - image: This is the icon path. It is recommended to use a PNG file. Place the image in the
img
folder and rename it as desired. ReplaceFILE_NAME
with the name of your image (e.g.,'../img/image1.png'
).
Here’s how the template looks:
const actionStyles = {
name: { color: '', image: '../img/FILE_NAME.png' },
};
To add a custom notification type, you can do something like this:
Feel free to customize the name, color, and image path according to your preferences!
actionStyles.customType = {
color: 'rgb(255, 165, 0)', image: '../img/custom_icon.png'
};
You can modify the location of the notification!
To use the pre-defined locations, find the following code in the config.lua
file:
Cfg.Location = 'center-right'
Set Cfg.Location
to one of the following values:
'top'
'top-right'
'top-left'
'center'
'center-right'
'center-left'
'bottom'
'bottom-right'
'bottom-left'
You can also create custom locations or modify the existing ones.
- Locate the following code in the
config.lua
file:
Cfg.LocationMapping = {
['top'] = {right = '50%', top = '94%'},
['top-right'] = {right = '1%', top = '94%'},
['top-left'] = {left = '1%', top = '94%'},
['center'] = {right = '50%', top = '35%'},
['center-right'] = {right = '1%', top = '35%'},
['center-left'] = {left = '1%', top = '35%'},
['bottom'] = {right = '50%', top = '6%'},
['bottom-right'] = {right = '1%', top = '6%'},
['bottom-left'] = {left = '1%', top = '6%'},
}
- Modify any of the pre-defined locations or create your own!
To create a custom location, you can adjust three parameters:
top
➡️ Distance from the top of the screenright
➡️ Distance from the rightleft
➡️ Distance from the left
If you want to change only one parameter, you can remove the others; the script will set their value to 'auto'. You only need to use either 'left'
or 'right'
, not both.
Cfg.LocationMapping = {
['my-custom-location'] = {left = '10px', top = '5px'}, -- Can use px suffix :D
['my-custom-location2'] = {left = '6%'}, -- Modify one parameter!
}
To apply the custom location tag to the script, change Cfg.Location
:
Cfg.Location = 'my-custom-location'
You can make the corners rounded or modify them.
Find the following code in the config.lua
file:
Cfg.Corners = 'rounded'
Modify the value to one of the following options:
'super-rounded'
➡️ Very rounded corners!'rounded'
➡️ Normal rounded corners.'custom'
➡️ Allows for custom rounded corners.'normal'
➡️ Removes rounded corners.
To apply a custom value, set Cfg.Corners
to 'custom'
:
Cfg.Corners = 'custom'
Then find the following code in the config.lua
file and modify the value:
Cfg.CustomRadius = '15px'
Change the background color of the notifications.
Find the following code in the config.lua
file and modify the value:
Cfg.BackGround = 'dimgrey'
You can also use:
Cfg.BackGround = '#333'
Cfg.BackGround = '#333333'
Cfg.BackGround = 'rgb(51, 51, 51)'
Ensure the text colors are adjusted for visibility!
To change the text colors, find the following codes in the config.lua
file and modify them:
Cfg.TitleColor = '#fff'
Cfg.MessageColor = '#fff'
Modify the divider line between the notification header and message.
Find the following codes in the config.lua
file:
Cfg.Divider = true
Cfg.DividerColor = 'gray'
Disable the divider line by setting Cfg.Divider
to false
:
Cfg.Divider = false
Cfg.DividerColor = 'gray'
To change the color of the divider, modify the Cfg.DividerColor
value. Examples:
Cfg.Divider = true
Cfg.DividerColor = 'gray'
Cfg.Divider = true
Cfg.DividerColor = '#555'
Cfg.Divider = true
Cfg.DividerColor = '#555555'
Cfg.Divider = true
Cfg.DividerColor = 'rgb(85, 85, 85)'
Enable a glowing effect around the notifications!
Find the following code in the config.lua
file and enable or disable it:
Cfg.Glowing = true
Modify the height and width of the notifications.
Find the following codes in the config.lua
file:
Cfg.MinHeight = 'auto'
Cfg.MaxHeight = '6%'
Cfg.HeightSize = 'auto'
Cfg.MinWidth = '300px'
Cfg.MaxWidth = '390px'
Cfg.WidthSize = 'auto'
The Cfg.MinHeight
and Cfg.MinWidth
properties enforce minimum sizes:
- If
Cfg.MinWidth
is set to'30px'
, the width cannot be lower than'30px'
. - You can also set this option to
'auto'
.
The Cfg.MaxHeight
and Cfg.MaxWidth
properties enforce maximum sizes:
- If
Cfg.MaxWidth
is set to'300px'
, the width cannot exceed'300px'
. - You can also set this option to
'auto'
.
The Cfg.WidthSize
and Cfg.HeightSize
properties change the actual notification size.
- You cannot set these values lower than
Cfg.MinHeight
andCfg.MinWidth
values.
Adjust the size of the icons!
Find the following code in the config.lua
file to adjust the logo size:
Cfg.ImageSize = '24px'
To change the images, go to the appropriate folder and replace the images:
- Ensure to use PNG formatted images!
- Images must have a transparent background.
Modify the default duration of notifications.
Locate the following code in the config.lua
file:
Cfg.DefaultDuration = 5000
To modify the default title of notifications, find the following codes in the config.lua
file:
Cfg.DefaultTitle = "Code Wizards"
Cfg.ForceDefaultTitle = false
To change the title, simply edit the Cfg.DefaultTitle
value.
To force the use of the default title on all notifications, edit the Cfg.ForceDefaultTitle
value.