The dark side of the moon, which is facing away from the sun, is always cold. However, when the moon passes between Earth and the sun, the part of the moon that faces us becomes extremely hot. This is called the lunar day. During the lunar night, the opposite happens.
Therefore, the temperature on the moon is a story of dramatic extremes. The areas that are touched by direct sunlight become heated to 127°C, whilst the dark side of the moon will be at a freezing -173°C. With no atmosphere to trap heat, and no particles to transfer heat, temperature in outer space is linked to light.