Congruences of the colorful grid

How can I build a colorful grid in Mathematica representing the rest of $ x ^ {y} $ modulo a given prime number $ p $? (with coordinates)
As such:

enter the description of the image here

nt.number theory – Number of solutions to certain quadratic congruences

assume $ p $ and $ q $ are prime numbers and $ p neq q $ and $ | x |, | y | <p <q <2p $ so how many solutions can we expect from congruences
$$ x ^ 2y ^ 2-ry ^ 2 equiv a bmod p $$
$$ x ^ 2y ^ 2-r ^ x 2 equiv b bmod q $$ or $ r, r, a, b in mathbb Z backslash {0 } $ are given with $ mathsf {GCD} (ab, pq) = $ 1?