1. Home
  2. Matador Extensions
  3. Discord Notifications
  4. Changing the colour of Discord Notifications
  1. Home
  2. Matador Extensions
  3. Changing the colour of Discord Notifications

Changing the colour of Discord Notifications

Application and Job Notifications in Discord, have a little strip of colour down their lefthand side that looks like this:

By default this strip of colour is red, but you may want to alter this to match your site’s branding.

First, you will need to find the relevant colour code for your chosen colour. Discord accepts decimal colour values, so you will need to find the decimal value of your chosen colour. E.G. the default colour is 15548997, which is #ED4245 in hexadecimal format and (237, 66, 69) in rgb format. A quick search online should give you many sites which will convert a colour in a given format to a decimal colour.

Once you have the decimal value of your colour, you will need to use the ‘discord_jobs_notification_color’ or the ‘discord_applications_notification_color’ filter to modify the colour value used when creating the notification.

/**
 * Filters the notification message color for application notifications in Discord.
 *
 * @since 1.0.0
 *
 * @param int   $color The default notification color in its decimal representation. Default is 15548997.
 * @param array $data  An associative array containing application data
 * @param int   $wpid  The WordPress ID of the candidate
 */
$color = apply_filters( 'discord_applications_notification_color', 15548997, $data, $wpid );

Here’s an example of changing the colour to pink for both the jobs and the applications:

/**
 * Changes the notification color to pink for Discord job notifications.
 *
 * @param int   $color The original color value. Default is 15548997.
 * @param array $job   The job object containing details about the job.
 * @param int   $wpid  The WordPress ID of the job.
 * @return int Modified color value in decimal format.
 */
function change_discord_notification_color_to_pink( $color, $job, $wpid ) {
    return 16761035; // Decimal value for the color pink (#FFC0CB).
}

// Hook the above function into 'discord_jobs_notification_color' filter
add_filter( 'discord_jobs_notification_color', 'change_discord_notification_color_to_pink', 10, 3 );

// Hook the above function into 'discord_applications_notification_color' filter
add_filter( 'discord_applications_notification_color', 'change_discord_notification_color_to_pink', 10, 3 );
Updated on February 27, 2024
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support