When you send a webhook message to Discord with a custom embed, the color bar on the left side may appear black even though you provided a valid hex color code. This problem happens because the color value in your JSON payload is not formatted correctly or the hex code is missing the required prefix. This article explains the exact cause of the black color issue and provides step-by-step commands to fix your webhook code so the embed displays the intended color.
Key Takeaways: Fixing Black Embed Color in Discord Webhooks
- Convert hex code to decimal integer: Discord requires the color value as a decimal integer, not a hex string with a hash symbol.
- Remove the # symbol before conversion: The hex code must be stripped of the # prefix before converting to decimal.
- Use a calculator or programming function: Convert the hex value to decimal using a tool like parseInt() in JavaScript or int() in Python.
Why the Embed Color Appears Black Instead of Your Hex Code
Discord’s webhook API expects the color field in the embed object to be an integer, not a string. If you send a hex code like #FF5733 as a string, Discord cannot interpret it and defaults to black. The same happens if you send the hex code as a string without the hash symbol, such as "FF5733".
The correct value must be a decimal integer between 0 and 16777215. For example, the hex code #FF5733 converts to the decimal integer 16737075. When you send this integer in the JSON payload, Discord renders the embed with the correct color.
How Discord Processes the Color Field
Discord’s API parses the color field as a 24-bit RGB value. The integer represents the red, green, and blue channels combined. If the field is missing, null, or a string, Discord defaults to black. The API does not perform any conversion from hex strings to integers.
Common Misconception About Hex Codes
Some developers assume Discord accepts hex strings because other platforms do. Discord never accepted hex strings in the color field. The API documentation explicitly states the color must be an integer. Sending a hex string, even with the hash symbol, will always result in a black embed.
Steps to Fix the Black Embed Color
Follow these steps to correct the color value in your webhook payload.
- Identify the hex color code you want to use
Write down the hex code without the hash symbol. For example, if you want the color#00FF00, note00FF00. - Convert the hex code to a decimal integer
Use a programming function or an online converter. In JavaScript, useparseInt("00FF00", 16)which returns65280. In Python, useint("00FF00", 16). In Excel, useHEX2DEC("00FF00"). - Replace the color field in your JSON payload
Change the color value from a string to the decimal integer. Before:"color": "#00FF00". After:"color": 65280. - Send the webhook request again
Use your webhook URL and the corrected JSON payload. The embed should now display the green color bar instead of black.
Example: Correct JSON Payload
Here is a complete example of a working webhook payload with the color set to orange (#FFA500 converted to 16753920).
{
"embeds": [
{
"title": "Order Confirmed",
"color": 16753920,
"fields": [
{
"name": "Order ID",
"value": "12345"
}
]
}
]
}
If the Embed Color Still Shows Black After the Fix
If you have converted the hex code to a decimal integer but the embed remains black, check these three common mistakes.
Integer Value Exceeds 16777215
Discord’s color integer must be between 0 and 16777215. If your decimal value is larger, the API ignores it and defaults to black. For example, a hex code like #FFFFFF converts to 16777215. A value of 16777216 or higher will fail. Use an online converter to verify your decimal value is within range.
Color Field Is Placed Inside a String
Make sure the color value is not inside quotation marks in the JSON. JSON strings are enclosed in double quotes. If you write "color": "16737075", Discord treats it as a string and defaults to black. The correct format is "color": 16737075 without quotes around the number.
JSON Payload Contains Extra Nested Objects
The color field must be a direct child of the embed object. If you accidentally nest it inside another object, Discord cannot find it. Verify your JSON structure matches the example above. Use a JSON validator to ensure the payload is properly formatted.
Discord Webhook Color Value Formats: Integer vs Hex String
| Item | Integer (Correct) | Hex String (Incorrect) |
|---|---|---|
| Example value | 16737075 | “#FF5733” or “FF5733” |
| Discord API acceptance | Renders the color | Defaults to black |
| Data type in JSON | Number (no quotes) | String (with quotes) |
| Conversion required | None | Must convert to integer |
After you correct the color field to a decimal integer, your webhook embed will display the intended color. Test your payload with a simple embed before adding complex fields. Use the parseInt() or int() function to convert hex codes quickly. For advanced usage, consider building a color picker tool that outputs the decimal value directly.