Even though light often looks white, it is made up of lots of different colours all added together. The range of colours that make up the white light is called the spectrum of the light. We can talk about different parts of the spectrum, like the blue part or the red part.
White light can be split up into its different colours using a prism. When the light moves from the air into the prism it is bent, and we call this refraction. The different colours are bent by different amounts. This leads to them coming out of the prism at different angles.
We often want to know exactly what colours of light there are coming from a star or galaxy. To measure this we use an instrument called a spectroscope. These have prisms, or gratings, inside them which separate the light. They then record the data.
We can see other features in a spectrum using a spectrograph. Sometimes there are bright lines which are made when a lot of light is emitted at a particular wavelength. This could be from a nearby star forming region. Sometimes there are dark lines which are made when some light is blocked or absorbed. This can happen a lot with stars, which have their own atmospheres. This contains lots of different atoms and molecules that block particular wavelengths, or colours, of light. The colour which is blocked depends on what atom is in the way. Our Sun has hundreds of these dark lines at different colours, all due to atoms in the Sun's atmosphere.