Presets
Create reusable notification styles with custom icons, colors, typography, animations and sounds.
Integration notes
Reusable styles
Define a notification preset under a name, then call that name to reuse all of its style and sound settings.
Default preset examples
Default presets
Define reusable default and error notification styles.
createPreset('default', {
img = 'logo',
iconBg = 'rgb(40, 6, 63)',
iconColor = 'rgb(255,255,255)',
headerStripe = true,
bgHeader = false,
headerFontsize = '1',
msgFontSize = '0.8',
leftBorder = 'rgb(255, 123, 0)',
bgLeft = 'rgba(40, 6, 63, 0.45)',
bgRight = 'rgba(20, 20, 20, 0.5)',
textColor = 'rgb(255, 255, 255)',
headerColor = 'rgb(255, 255, 0)',
pulseAnimation = true,
-- soundEffect = '',
-- soundVolume = 0.015
})
createPreset('error', {
ikon = 'fas fa-times-circle',
iconBg = 'rgb(255, 0, 0)',
iconColor = 'rgb(255,255,255)',
headerStripe = true,
bgHeader = true,
headerFontsize = '1',
msgFontSize = '0.8',
leftBorder = 'rgb(255, 0, 0)',
bgLeft = 'rgba(200, 20, 20, 0.35)',
bgRight = 'rgba(45, 45, 45, 0.5)',
textColor = 'rgb(255, 255, 255)',
headerColor = 'rgb(255, 255, 255)',
pulseAnimation = true,
soundEffect = 'error.mp3',
soundVolume = 0.015
})
Variables
imgStringUses a custom image from the html/img folder as the notification icon.
ikonStringUses a Font Awesome icon. Set either ikon or img, not both.
iconBgStringSets the icon background color.
iconColorStringSets the icon color when using ikon.
bgHeaderBooleanEnables a full background for the header.
headerStripeBooleanEnables the gradient line below the header. This does not work when bgHeader is true.
headerFontsizeNumberSets the header font size.
msgFontSizeNumberSets the message font size.
leftBorderStringSets the notification left border color.
bgLeftStringSets the starting color of the notification background gradient.
bgRightStringSets the ending color of the notification background gradient.
textColorStringSets the message text color.
headerColorStringSets the header text color.
pulseAnimationBooleanEnables or disables the notification pulse animation.
soundEffectStringSets the notification sound effect. Comment out or remove this variable to disable it; .mp3 is recommended.
soundVolumeNumberSets the sound effect volume.
RGB(A) colors
Integration notes
Alpha channel
To add transparency to an RGB color, change rgb(255,255,255) to an RGBA value such as rgba(255,255,255, .5).