As a note, it is usually required to specify background colors depending on the values.
To do this, you can:
k = Table[RandomInteger[{1, 2}], {4}, {7}];
Grid[k,
Background ->
{None, None,
Join[
Position[k, 1] /. {x_, y_} -> ({x, y} -> LightRed),
Position[k, 2] /. {x_, y_} -> ({x, y} -> LightBlue)]
}]

Edit
If you do not know a priori the range of values, you can try something like:
k = Table[RandomInteger[{1, 20}], {4}, {7}];
Grid[k,
Frame -> All,
ItemStyle -> Directive[FontSize -> 16],
Background ->
{None, None,
Flatten@Array[List[
ColorData["Rainbow"][(k[[
Dimensions@k]
}
]

source
share