Tables with background colors set per row
I want to be able to add class=mw-datatable to tables, and not lose the background colors set for rows.
Please see User:Timeshifter/Sandbox152. The table excerpt there is from the "Top scorers" section of this version of Denmark men's national handball team. It is common in many sport statistics tables to add a background color to some of the rows. In this table excerpt the rows for still active national team players are highlighted.
The first table in the sandbox is without class=mw-datatable. The second table is with class=mw-datatable. You can see how the class removes the background colors for rows and substitutes the white background color of the rest of the table data cells.
Tables with background colors set per data cell
class=mw-datatable respects the inline background color when that color is set per data cell. For example; on the many tables that use a color gradient template on a per cell basis. For example; see the rate column in the main table in this version of List of countries by intentional homicide rate. That main table uses class="mw-datatable wikitable" and it is not a problem. The background colors set per cell remain.
Why it is important
class=mw-datatable (usually combined with class=wikitable) is used more and more. It produces a white background color that is preferred by many for statistic tables. Due to the better contrast and readability for many people. Versus the light gray background color of class=wikitable used alone. Plus class=mw-datatable will highlight the row that the cursor hovers over. Making it easier to scan across that row, especially if it is a long row.
Also, if this is fixed, then this row numbers auxiliary template can be used on more tables, especially sport statistic tables: Template:Static row numbers table. It uses class="mw-datatable wikitable". This template is used with: Template:Static row numbers. The 2 templates together make setting up row numbers on a table very fast.