I'd like to use built-in theming for conditional formatting on a table but the colors are so dark that the text doesn't show through very well. Is there a way to set the background opacity?
I've tried a few things with no success.
Setting opacity (this changes the entire opacity of the cell on the table)
Setting backgroundImage to some sort of gradient but this doesn't really affect the opacity
So if the value is above a target I want it to be var(--success) else var(--error) but they're too dark and I feel like they make the text of the table unreadable.
But still not really what I'm looking for. I want to keep using the built in theme colors otherwise I would use the hex equivalent of that color and add an opacity modifier to it like #de1b1b becomes #de1b1b7f or 50% opacity.
I agree that they make the text unreadable. Black on red is particularly difficult. I've never seen a display like this that I thought communicated clearly.
One I've used is to create an indicator on one edge of the cell using the left or right border.
Even with your red/green table I'd leave out the green background if there are only two possible states. Have everything normal or highlighted. Simplifying further, leave everything on the neutral background and use bold to indicate a problem. Go for easy-on-the-eye, clear data and highlight only what's required.
Give us a screengrab of the finished opus!
Don't forget to right align the numbers and throw a bit of right-padding in there! (Add them into the style class.)
You could also add a 1px margin at the top or bottom of the cell to add a break between adjacent indicators.
Fwiw, you can modify variable colours using the from keyword eg hsl(from(var(--indicator) h s l / 20%) will set the alpha channel / transparency to 20% while keeping the other values the same
Hex codes are a bit gross for humans, I'd suggest hsl instead as it's immensely easier to understand (h ranges from 0 to 359 deg where every 30deg is a different primary/secondary colour red 0 orange 30 yellow 60 etc, and s and l are pretty self explanatory) hsl is also very easy to manipulate via script
Lovely ideas!
Out of curiosity, what do you use for your snipping tool to get that rugged bottom look?
I've been using ShareX which is pretty powerful, but not sure it can do that.
Store the raw data in a custom prop. Then bind the table's data to that prop and reprocess it, adding styles to modify how it looks depending on whatever conditions should affect how it looks.
The two features I use most are the torn edge and the Add Counter. The user interface is a little quirky (but OK) and one cool feature is that when you save the image the full path is put on the Clipboard so that you can past it into the forum's image upload dialog.
You can just paste the copied image in the clipboard into the post, rather than selecting a file name. It's a lot easier and means you don't need to save a local file