
Better conditional formatting text
We tuned up when to use white or black text with conditional formatting and cell highlighting to make sure the values pop.
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
This uh this is kind of in the category a little bit experimental too but um see let's go and share my screen so we can do a lot of sideby-side stuff here. Uh so earlier this week we had a customer post on kind of like the community site about um handling of conditionally formatted text and black and white on top of colors.
And so um there's kind of this new stuff in CSS where you can like do relative colors based on other colors and um kind of like playing with that stuff. So, um, want to see if we can make that happen. So, on the left here is kind of the current experience. And then, um, the right here is some of the stuff I've been playing with here the past couple days of like, uh, see if we can do better better formatting text by default on top of conditionally formatted boxes.
So, you know, here on the left, you can see kind of the red and the greens don't do so well. It also has the issue of if you switch to dark mode where now the yellow becomes unreadable. um on the right here. If I change it, uh you'll see that since this is like kind of dynamically picking the text color based on the uh luminosity of this potentially formatted cell, it kind of maintains its um readability across both light and dark mode, which is really nice.
Um and then I also looked at like trying to make sure we can um you know keep this working across all these things. I have a bunch of like ugly tables that I built like so um make sure that if you like previously you know if you override the text color here um if we'll switch it should maintain that text color so like I set this to yellow so it works well you can set the colors you can make the tables look really ugly and like tear over it all the styles to test what looks like initially format still looks good um you know test it with banding to make sure it works with cross banding and all these things and then uh This is
my rainbow eyebleleed uh query here that I just will compare like all these different colors to see how it looks, how it performs against all these things. So like here on the left is the defaults with various uh color schemes applied here. You can see you know vast majority of them are unreadable. In this case on the right a lot of them are just look a lot better.
So um it's pretty awesome. It's like two lines of CSS to actually get this to work uh for custom colors. And yeah, I think it's, you know, I think it's probably shippable. There's a few UX things you have to go figure out about like setting colors, but overall it's quite quite a lot better. So I think it's browser support for that pretty widespread, Jared.
Yeah, that's why I wouldn't chase it because there this this is recently landed in all the browsers and full support for these relative colors. And so, um, there's actually like another one that handles it even better for you, but it's only supported supported in Safari and I tested it out and actually works a little bit worse than this kind of behavior that I tested here.
So, um, yeah, brow support is solved for all that. This is sick. This is where it's amazing when a customer can reach out to us, point out a thing that we can go actually fix, and then we can make the product better.