Color isn’t quite what you think it is. Color is something also based on patterns that our brain has learned and then keeps using that pattern to make sense of the world around us. If you look at the top of the cube, what color is the center square? Look at the left-facing cube (in shadow) and decide what color is that center square. Are they the same or different? There is something known as color constancy, and our brain knows from its experience that colors in shadow are darker than they are in light. That makes the center square on the left look like a different color than the center square on top. Now if we take away some of the other signals that tells your brain to account for shadows, look what happens. Use the slider to isolate those two blocks and you’ll see they are the exact same color and shade.
Now you mind doesn’t have to account for the shading and it doesn’t cause the color illusion any longer.