Jason Randall
Jason Randall

Reputation: 1

Google Docs API TextStyle ForegroundColor for Dark Mode in Java

I am creating a Google Doc and need to use different foreground and background colors throughout my document. When I set a background color and want it to revert back to the default, I simply pass null for my background color:

textStyle.setBackgroundColor(new OptionalColor()
                .setColor(null));

This works as expected: click here to see background call working as expected

I am trying to follow this same pattern for my foreground color as well, so the text works in both "light" mode and "dark" mode. I pass null for my foreground color:

textStyle.setForegroundColor(new OptionalColor()
               .setColor(null));

This works as expected in "light" mode (see image above), but the font does not change automatically to support "dark" mode (text highlighted for visibility): click here to see foreground call NOT working as expected in dark mode

How can I set the foreground color to the "default" value in Google Docs so it displays properly in both "light" and "dark" mode.

Upvotes: 0

Views: 49

Answers (0)

Related Questions