React-data-grid: Force light theme

Created on 3 Oct 2020  路  4Comments  路  Source: adazzle/react-data-grid

It should be possibile to set the class rdg-light to force the table in light mode even when OS is set to dark mode and avoid unwanted behaviours. See CSS below:

@media (prefers-color-scheme: dark) .rdg:not(.rdg-light) { --color: #ddd; --border-color: #444; --summary-border-color: #555; --background-color: #222; --header-background-color: #1c1c1c; --row-hover-background-color: #181818; --row-selected-background-color: #1a73bc; --row-selected-hover-background-color: #1868aa; --checkbox-color: #95cfff; --checkbox-focus-color: #c8e6ff; --checkbox-disabled-border-color: #000; --checkbox-disabled-background-color: #333; }

Most helpful comment

@iosonosempreio I simply added .rdg-light as className in DataTable, I guess you could add a flag as dark/light mode and control adding this class.

All 4 comments

@iosonosempreio I simply added .rdg-light as className in DataTable, I guess you could add a flag as dark/light mode and control adding this class.

As mentioned above, adding rdg-light className should fix the issue

@iosonosempreio I simply added .rdg-light as className in DataTable, I guess you could add a flag as dark/light mode and control adding this class.

How to please ?!
I need the DataGrid to be light or white

@stonestecnologia <DataGrid className='rdg-light' columns={columns} rows={rows} />

Was this page helpful?
0 / 5 - 0 ratings