glide-data-grid icon indicating copy to clipboard operation
glide-data-grid copied to clipboard

customize background color

Open bjgrosse opened this issue 4 years ago • 6 comments

I'd really like to be able to customize the background color of non data cells (ie., the cells below and to the right of my data). It seems they are always painted white and there's no way to control that or even paint over it.

bjgrosse avatar Jan 27 '22 15:01 bjgrosse

Using a ThemeProvider and setting bgCell: '<your color>' colors the cells below and to the right for me.

<ThemeProvider theme={{ bgCell: '#FF0000' }}>
  <DataEditor ... />
</ThemeProvider>
Screen Shot 2022-01-27 at 10 59 47 AM

pzcfg avatar Jan 27 '22 19:01 pzcfg

@bjgrosse does @pzcfg's solution resolve your issue? if not, I'll leave this issue open.

bryhasagithub avatar Feb 01 '22 00:02 bryhasagithub

You can do this by setting the root themeProviders bgCell: to whatever you want the non-data cell background to be, and then for every cell you produce out of getCellContent you can provide a different bgCell value in the overrideTheme.

jassmith avatar Feb 02 '22 21:02 jassmith

You can also do this at the column level instead for a slightly different effect (rows that are blank because there is not enough data will still color as the override color)

jassmith avatar Feb 02 '22 21:02 jassmith

The problem with this solution is that the bgCell colors the row headers as well, which looks odd:

image

bjgrosse avatar Apr 21 '22 09:04 bjgrosse

@jassmith there's another reason this approach doesn't work: the bgCell of the global theme is what is used for the background of the DataGridOverlayEditorStyle and thus the bgCell of the themeOverride on the cell itself is not honored:

image

bjgrosse avatar Apr 21 '22 09:04 bjgrosse