This subject can be a pretty daunting, so to simplify let’s start by inventing our own colour space. We’ll call it RAINBOW!
RAINBOW colour space is going to be very simple and only represents 7 possible colours, with corresponding values of 0.1 – 0.7.
0.1 = Red, 0.2 = Orange, 0.3 = Yellow, 0.4 = Green, 0.5 = Blue, 0.6 = Indigo, 0.7= Violet
An image file that is encoded in RAINBOW colour space will simply contain a long list of the above numbers (one for each pixel), and hopefully a bit of metadata noting that is is in RAINBOW colour space. When you open the file, your computer will read the metadata, seeing that it is in RAINBOW, and then start reading the image data. If a pixel has a value of 0.1, the computer will refer to RAINBOW in it’s list of colour spaces and find that 0.1 should be red. That pixel will then be displayed as red on your monitor, and so on. If the metadata is missing then the computer will take a guess as to the colourspace and most likely assume sRGB (the most common colour space for computer monitors).