Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
billbliss opened this issue Aug 8, 2017 · 5 comments
Open

Comments

@billbliss
Copy link
Contributor

billbliss commented Aug 8, 2017

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;
    }
@majordamage
Copy link

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.

@billbliss
Copy link
Contributor Author

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

@billbliss
Copy link
Contributor Author

(That documentation is incorrect.)

@majordamage
Copy link

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

@RamjotSingh
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants