DataTablesSrc icon indicating copy to clipboard operation
DataTablesSrc copied to clipboard

The color of the tables' body should be set

Open shrektan opened this issue 5 years ago • 5 comments

Hi,

First of all, I'm using the default theme as an example. It should apply to other themes as well.

Now the default theme of datatables sets the "background-color" to "white", but not the "color" of the table. It causes an issue that the users will see a blank table when the color of the whole page is set to "white" (for example, in a dark theme).

In addition, from the below screenshot we can know that all other font elements of the table are using #333 as the font color. The only exception is the table body. I don't know if there's any special reason for doing that.

So my suggestion is that datatables should set the color to "#333" explicitly.

Thanks.

(This issue is originally discussed at https://github.com/rstudio/DT/pull/767 , if you are interested)

When we set the color of the page to white, the content of the table is missing

image

shrektan avatar Mar 18 '20 02:03 shrektan

I actually disagree with this one I'm afraid. My feeling is that DataTables should inherit whatever the body text colour is - that way it will work automatically if you are using it with a dark themed site or with a light themed site.

If you need to change it for your site a single line of CSS would be all is needed.

Ideally the DataTables stylesheet should be defining as little "theme" styling as possible.

DataTables avatar Mar 18 '20 09:03 DataTables

@DataTables Yes, it should inherit the body text, I agree with you.

However, why the background of the table is not inheritable? The font color of the buttons is not inheritable, either.

I mean it's inconsistent.

In a dark theme, the background of the table doesn't inherit from the parent DOM but the font color does. It results in a table with a white background (because it's hardcoded, but I expect it inherit from the parent and to be "dark") and white font color (inherited).

So in a dark theme we can see that all other elements are actually hard-coded but only the font color of the body

shrektan avatar Mar 18 '20 10:03 shrektan

Ah I'm with you now - this example demonstrates it nicely: http://live.datatables.net/hedekori/1/edit .

I agree - DataTables' row styling should be using rgba only. I will be updating that in the v2 branch.

DataTables avatar Mar 18 '20 10:03 DataTables

Great! Thanks.

So should we leave this issue open or closed?

shrektan avatar Mar 18 '20 10:03 shrektan

Makes sense to leave it open since it is unresolved atm. Thanks!

DataTables avatar Mar 18 '20 10:03 DataTables