Francesca
Francesca

Reputation: 81

How to change the text color of a MS teams Message Card

I am using AWS Lambda with a webhook to post to a Teams Channel. How do I change the text color in the card?

AFAIK, Adaptive Cards are not an option for webhooks yet. I have tried using the Message Card playground but there is not an option for the legacy Message Card, and other sites I've looked at don't have a text color option.

I'd like to change the color of the title, but the following has not worked.

Code I've tried:

data = {
            "@context": "https://schema.org/extensions",
            "@type": "MessageCard",
            "themeColor": "0072C6",
            "color": "FF0000",
            "title": self.title + " Severity: " + str(self.severity),
            "text": self.findings + "\n Account: "+self.account+" \nTags: " + json.dumps(self.tags)} ```

Upvotes: 3

Views: 12009

Answers (3)

Nabil Mohammed Asif
Nabil Mohammed Asif

Reputation: 21

It is possible! Use simple html formatting.

json_data = {
    "@type": "MessageCard",
    "themeColor": "0bd700",
    "summary": "Successful Bamboo Deployment",
    "sections": 
    [{
        "activityTitle": '<h1 style="color:green;"> Successful Deployment </h1>',
    }]
}

Click here to see what it does

Upvotes: 1

Sebastian Zalewski
Sebastian Zalewski

Reputation: 89

It is possible by HTML formatting eg. in title or text. It works for me

<strong style="color:blue;"> My title </strong>

Upvotes: 3

Francesca
Francesca

Reputation: 81

As @Trinetra-MSFT mentioned, there is not an option to change text color in MS Message Cards.

Upvotes: 1

Related Questions