As Pinguin Dirk comments there is an example of exactly this in the documentation:
Grid[Table[x, {4}, {7}],
Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]
Those who value brevity may wish to note that implicit Null
may be used in place of None
:
Background -> {, , {{1, 1} -> Pink, {3, 3} -> Red}}
You can also use Item
and MapAt
:
tbl = Table[x, {4}, {7}];
MapAt[Item[#, Background -> Pink] &, tbl, {{3, 3}, {2, 6}}] // Grid
You could also use Style
but that won't fill the cell (can be finetuned by using Pane
though):
{Grid[{{1, 2}, {3, Style[4, Background -> Pink]}}, Frame -> All],
Grid[{{1, 2}, {3, Item[4, Background -> Pink]}}, Frame -> All]}
Grid[Table[x, {4}, {7}], Background -> {None, None, {{1, 1} -> Pink, {3, 3} -> Red}}]
(section:Background
) $\endgroup$