What I’m trying to do
I would like to have a table, with alternating colors row-wise, and with a third color for the header. None of the colors should be transparent, i.e., the background of the “paper” should never be seen in the table.
I thought this could be solved by setting --table-background
(it sets the default background of all cells, unless something else overwrites it - right?) to some color - this would color the odd rows in the end.
--table-header-background
would set the color of the header and it would overwrite the previous value set by the --table-background
variable.
--table-row-alt-background
would set the color of the other rows (even rows) - again overwriting the default value set by the --table-background
variable. Here is an example of what I want (note: not actually the colors I want to use, but this makes the example easier):
- Sheet background color: blue.
- Table background color: red.
- Table header color: green.
- Table alternate row color: orange.
The image below is a simple representation I made in GIMP, for what I am trying to do
The css file I am using looks like this:
.theme-dark {
/* COLORS [FOUNDATIONS] */
--background-primary: blue;
/* TABLE [EDITOR] */
--table-background: red;
--table-header-background: green;
--table-row-alt-background: orange;
/* --table-column-alt-background: purple; */
}
The issue
What I actually get looks something like this:
What is interesting is what happens when I comment out the --table-background
, then I get the (to me) intended behavior, except every second row is now transparent:
As far as I can see the reference page for the css variables for the table class, it does not mention anything about coloring alternating columns by default when using the --table-background
variable. As can be seen in my css file, I have also tried to comment in the --table-column-alt-background
variable (I chose purple to show which cells it affects) - but that overrides everything in the alternate columns, even the header:
I know I could overwrite the colors with a custom table class, however, I imagine that what I showed here would (should?) also work. If this is intended behavior feel free say so, I am new to CSS and this might be common knowledge.
in short: Is the alternate coloring with the --table-background
variable intended when using other color variables for tables? and is there a way to get my intended behavior, without using custom css class?