The default text button style is TEXT, but if you want it to have a background, it needs to be of type FILLED.
const textButton = CardService.newTextButton();
textButton.setText("Update Draft");
textButton.setTextButtonStyle(TextButtonStyle.FILLED);
textButton.setBackgroundColor('#d85300');
The line in question here is the third line, the setTextButtonStyle method. The method takes an enum of type TextButtonStyle, the default value is TEXT but we need to change it to FILLED so that we can add a background color.
The problem is, using TextButtonStyle.FILLED should work, that's how you access the enum value.
Here's the link to the documentation.
If you would like even more reference, I am creating a Google Workplace Gmail Add-on.
I'm creating a contextual compose interface. Again, here's the docs.
https://developers.google.com/workspace/add-ons/gmail/extending-compose-ui
When I run my app, I get the error
ReferenceError: TextButtonStyle is not defined
I've tried accessing the enum a few ways, it should work and I don't know why it doesn't.
For anyone who gets stuck, their documentation isn't clear about this, you need to chain the methods in order for this to work. Here's a working example.
const textButton = CardService.newTextButton()
.setText("Update Draft")
.setTextButtonStyle(CardService.TextButtonStyle.FILLED)
.setBackgroundColor('#d85300');