To make Calc display grid lines over the background color, follow the following steps:
1: click on Tools -> Options... on the menubar to open Calc's options dialog window. This window has a list-detail layout.
2: navigate to LibreOffice Calc -> View on the side pane. View-related settings will be displayed in the detail pane.
3: under Visual Aids, click on the Grid Lines dropdown list button to change the setting from "Show," the default, to "Show on colored cells."
4: click the OK or Apply button to save your settings.
Having done this, grid lines will appear over cells that have a background color without you having to do anything.
Observations
It's not immediately clear that the Grid Lines setting would have any other option besides Show and Hide, as you would need to expand the dropdown list to see the third option. It would have been a better idea to make this a checkbox instead.
When I started using Calc, I assumed there was no way to change this behavior, since I can't imagine why would a spreadsheet application hide the grid lines by default. I assume other users have also been confused about this. For example:
Why do the grid lines not show when I apply a background color to a column?
https://ask.libreoffice.org/t/calc-grid-lines/23853, "Feb 19, 2017" (accessed 2025-02-16)
There are grid lines on the calc spreadsheet. When I set the background color of some columns, grid lines disappear from these columns. What should I do to have colored columns AND grid lines on them?
https://ask.libreoffice.org/t/grid-lines-disappear-when-i-set-the-background-color-of-the-column/65664, "Jun 25, 2021" (accessed 2025-02-16)
A Libre Office Calc spreadsheet field shows a grid of black horizontal and vertical lines indicating the columns and rows. The problem is when I use a background color to highlight adjacent rows, all of these black grid lines disappear, which makes it difficult to tell which grid box an entry is in. Is there a way to use background color and still see the black grid lines? Thanks.
https://ask.libreoffice.org/t/no-grid-lines-in-background-color/86688, "Jan 18, 2023" (accessed 2025-02-16)