Both squares are exactly the same color: #888888. Their surroundings can change how we perceive them.
The gray squares never change. Only their backgrounds do.
Colored light combines additively. Red and green produce yellow. Green and blue produce cyan. Blue and red produce magenta. All three together produce white where their light overlaps. This is different from mixing paint.