You’re right, squids squirt ink! They have ink sacs between their gills that they use to shoot out ink, mixed in with some water to make it spread out more.
Even though different species make different colours, the inks are usually dark because they’re mostly made of the melanin pigment – the same pigment that decides how dark our skin is. Then there’s lots of mucus in the ink too… like snot ha! The last bits are small amounts of proteins and some “dopamine” (which they actually give to people with Parkinson’s disease!).
Squids usually squirt ink to protect themselves because it makes a kind of smoke screen so that their predators can’t see them very well, then they run… I mean swim… off!
It would be like you throwing flour in someone’s face and running away!