Non-hex colors (danger/good/warn) are not displayed by `BlockAttachment`s
Reproducible in:
The Slack SDK version
slack-sdk 3.19.5
Python runtime version
python 3.7.15
OS info
ProductName: macOS ProductVersion: 13.2 BuildVersion: 22D49 Darwin Kernel Version 22.3.0: Thu Jan 5 20:48:54 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T6000
Steps to reproduce:
from slack_sdk import WebClient
CHANNEL = "INSERT A CHANNEL HERE"
TOKEN = "INSERT A SLACK TOKEN HERE"
text = "Lorem ipsum dolor sit amet, consectetur adipiscing eli"
client = WebClient(token=TOKEN)
client.chat_postMessage(
channel=CHANNEL,
text=text,
attachments=[
BlockAttachment(
blocks=[SectionBlock(text=text)],
color='danger'
)
]
)
Expected result:
I expect the attachment color to be RED (color='danger')
Actual result:
The color is grey

Also
I noticed that
BlockAttachment(blocks=[SectionBlock(text=text)], color='danger').color_valid()
ReturnsNone instead of True (and returns None regardless of whatever color I use, including hex codes)
Note that I also tried color "good" (same result - banner is grey)
But if I use a hex code for the color argument, the color will be displayed properly.

Hi @ADraginda, thanks for writing in! Unfortunately, the attachments do not support non-hex color names unlike blocks (Block Kit). So, please go ahead with a color code. I hope this helps.
Ah! That would explain it, thanks. Consider updating the docs as the entry for BlockAttachment suggests that you can use words for colors.
Thanks a lot for pointing the issue out! I will improve it later.
Updated the docs. Thanks again for flagging this!