I have happened to develop custom image parser, that takes bmp files and outputs set of mcfunctions with setblocks. I've used color table available on mc wiki, but seeing that it hasn't been updated to recent minecraft versions (1.13+) and there are now new undocumented colors on map, I tried to manually list them all.
Sadly, so far I've been unable to reproduce single accurate color already verified in mc wiki color table, eg. Wool is stated to have 220, 220, 220 RGB and I was able to extract 117, 117, 117 from my png screenshots. My question, is there any method you know that could extract valid map colors without digging through mc source code?
Ok, so i've been stumped by this too, but as it turns out, it hasn't changed from 1.12, the Wiki just has it described in a really confusing way.
According to the wiki, the colors listed are 51 base colors (and 1 transparent one), then you follow the instructions in the "Map colors" section, to find the real colors.
P.S. I'm not sure if you can make this mistake or not because of what you are trying to develop, but don't forget to account for the fact that values 0-3 are all transparent, but you still need to account for them. I made this mistake, and I nearly gave up on my program because of it because its so hard to find.