Change text color based on background

Is there a style setting so that the text color will be set to (say) black/white depending on the background color?

Hi Nigel:

Someone here may correct me, but I don’t believe there is any “automatic” color selection going on in Blocs.
I believe YOU need to set those colors up.

Rich the Weather Guy

Thanks Rich. I noticed the links on one of the nav bars changes with the background color and just thought there might be an option I’d missed.

You can create text blending like this with CSS. But it might not be what you are after exactly.

I am just using this

h2 {
	color: white;
	mix-blend-mode: difference;
/* alternative you can also use -  mix-blend-mode: exclusion; */

Still thinking about this, but this could well be what I want. Thanks!

Does this mean what ever I put before { will be targeted for using this feature? Examples: h1, h3, h3, h4, h5 or p
What is I want just a section and not all h2? How would I address that?

Use a class.

I just used an h2 tag in the example.

1 Like