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 {
--head-text-color: #111111;
--head-bg-color: #d9edf7;
--head-active-text-color: #111111;
--head-active-bg-color: #049cdb;
}
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, of the table head and footer rows. The lines of code with active
in the variable name indicate the colors of hovered header cells and the colors of header cells that are currently sorted. 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 thead th,
.tablepress tfoot th {
background-color: #ff0000;
color: #00ff00;
}
.tablepress thead .sorting_asc,
.tablepress thead .sorting_desc,
.tablepress thead .sorting:hover {
background-color: #00ff00;
color: #00ff00;
}
Code language: CSS (css)
You can change both the text color (via the color
property) and the background color (via the background-color
property).