BotBuilder-MicrosoftTeams icon indicating copy to clipboard operation
BotBuilder-MicrosoftTeams copied to clipboard

Please add simple "color" support to O365ConnectorCard.themeColor()

Open billbliss opened this issue 7 years ago • 5 comments

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;
    }

billbliss avatar Aug 08 '17 19:08 billbliss

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.

majordamage avatar Aug 11 '17 00:08 majordamage

That's nonsense. That's exactly what it's for.

billbliss avatar Aug 11 '17 06:08 billbliss

(That documentation is incorrect.)

billbliss avatar Aug 11 '17 06:08 billbliss

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...

majordamage avatar Aug 11 '17 17:08 majordamage

Are we looking into this? Or has this been resolved?

RamjotSingh avatar Sep 14 '17 23:09 RamjotSingh