BotBuilder-MicrosoftTeams
BotBuilder-MicrosoftTeams copied to clipboard
Please add simple "color" support to O365ConnectorCard.themeColor()
Request: add the special values good
, warning
, and danger
as theme colors. Slack has these and it's a lot easier than looking up the hex values.
I'm not set up to build or test this, but this works in my own version. If you'd rather, I could just submit a PR but it's not very clear how to set up the build environment and run the tests. @robin-liao I'll contact you offline.
Suggested source:
public themeColor(color: string): this {
if (color) {
color = color.toLowerCase();
switch (color) {
case "good":
(<teams.IO365ConnectorCard>this.data.content).themeColor = "#2ea34e"; // Green
break;
case "warning":
(<teams.IO365ConnectorCard>this.data.content).themeColor = "#de9d30"; // Yellow
break;
case "danger":
(<teams.IO365ConnectorCard>this.data.content).themeColor = "#d50000"; // Red
break;
default:
(<teams.IO365ConnectorCard>this.data.content).themeColor = color;
}
(<teams.IO365ConnectorCard>this.data.content).themeColor = color;
} else {
delete (<teams.IO365ConnectorCard>this.data.content).themeColor;
}
return this;
}
Current source:
public themeColor(color: string): this {
if (color) {
(<teams.IO365ConnectorCard>this.data.content).themeColor = color;
} else {
delete (<teams.IO365ConnectorCard>this.data.content).themeColor;
}
return this;
}
The documentation for themeColor appears to disallow such use. Quoting:
-
Do use
themeColor
to brand cards to your color. -
Don't use
themeColor
to indicate status.
That's nonsense. That's exactly what it's for.
(That documentation is incorrect.)
I suspect (although have no direct knowledge) that's why this property is named themeColor
instead of simply color
in the Slack style. Its usage parallels the ThemeColor
class in SharePoint.
Having said that, I don't see any other candidate property that'd serve the purpose you propose, so...
Are we looking into this? Or has this been resolved?