Red onions got their name because, at the time of their discovery, purple didn’t exist as a color descriptor. Over time, a more complex language for colors evolved, and hues like yellow, green, and, yes, purple, entered our vocabulary. As with many quirks of language, names don’t always evolve with our understanding of the world. (For example, the pineapple was named by a British explorer bereft of any understanding of the fruit.)
It may seem strange to think that specific names for colors are a matter of invention. After all, red and purple being two distinct colors seems like a simple fact today. However, it is important to note that language plays a big role in creating these variations. Pink, in particular, was not used as a color descriptor in English until the 17th century. And before the word orange was invented, orange items were often called red or geoluhread in English-speaking countries, which translates to yellow-red.
This goes for other colors too, such as blue in ancient greece. Also, Homer regarded wine, the sea, and sheep as all being the same colour, which is ‘red’.
Also in Japanese they didn’t had a separate word for green for a very long time. Green was just a shade of blue. It’s why a lot of things like fruits and vegetables have blue in the name like 青豆 aomame literally blue bean or 青林檎 aoringo literally blue apple. Or why they call the green light on traffic lights blue.
If you pickle that red onion, everything turns red. for example:

But that’s not the reason… from chowhound
This goes for other colors too, such as blue in ancient greece. Also, Homer regarded wine, the sea, and sheep as all being the same colour, which is ‘red’.
https://www.thearchaeologist.org/blog/why-there-was-no-word-for-blue-in-ancient-greece-and-how-homer-and-aristotle-perceived-colors
Also in Japanese they didn’t had a separate word for green for a very long time. Green was just a shade of blue. It’s why a lot of things like fruits and vegetables have blue in the name like 青豆 aomame literally blue bean or 青林檎 aoringo literally blue apple. Or why they call the green light on traffic lights blue.