This can be done with the some CSS code that needs to be added to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:
.tablepress {
--odd-text-color: #111111;
--odd-bg-color: #f9f9f9;
--even-text-color: #111111;
--even-bg-color: #ffffff;
}
Code language: CSS (css)
Here, the lines starting with --
indicate variables for the colors, with text
being the text color and bg
denoting the background color, either for odd
or even
rows. Just change the HEX color values as desired. You only need to specify the lines that you want to change.
If you prefer a visual interface for changing colors, check out the Default Style Customizer feature that is part of the TablePress premium license plans.
If you just want to change this for a specific table, use .tablepress-id-N
(with N
being the table’s ID) as the selector, instead of .tablepress
.
If the CSS code from above does not work, you can also try this alternative CSS code:
.tablepress .odd td {
background-color: #ff0000;
color: #00ff00;
}
.tablepress .even td {
background-color: #00ff00;
color: #0000ff;
}
Code language: CSS (css)
You can change both the text colors (via the color
property) and the background colors (via the background-color
property) of odd and even rows.