Anvinder - the problem is with the following two lines
Remember, a is a 256x256x3 matrix. In the above, you are only setting the Red component to zero. These two lines would be equivalent to
If you want the squares to be black, then you need to set all three components (red, green, and blue) to zero using
When I try the above, the pale blue squares are replaced with black ones.