Official Sources
The LEGO Shop page for the Color & Distance Sensor (88007) says:
Detect 6 colors and objects within 5 to 10 cm range with this robot toy accessory for kids.
Since this one is aimed at kids in the retail market, there isn't much in the way of official technical information on this sensor.
A LEGO Education blog post has this to say about the SPIKE color sensor:
-1 = No object
0 = Black (LEGO:26; R:0, G:0, B:0)
1 = Magenta (LEGO:124; R:144, G:31, B:118)
3 = Blue (LEGO:23; R:30, G:90, B:168)
4 = Turquoise (LEGO:322; R:104, G:195, B226)
5 = Green (LEGO:28; R:0, G:133, B:43)
7 = Yellow (LEGO:24; R:250, G:200, B:10)
9 = Red (LEGO:21; R:180, G:0, B:0)
10 = White (LEGO:01; R:244, G:244, B:244)
3rd-pary resources
Pybricks
At Pybricks, we use the raw HSV values (or convert raw RGB to HSV if HSV is not available) to do better color detection instead of relying on the detection built into the sensor firmware.
This is discussed in detail at https://github.com/pybricks/support/issues/116.
With some of the proposed changes, it is even possible to detect black vs. dark gray vs. light gray with both of these sensors.
Reverse engineering
This page on reverse engineering the BOOST Color Distance Sensor says:
Color values are:
- BLACK 0x00
- BLUE 0x03
- GREEN 0x05 (Cyan or Turquoise in RGB LED)
- YELLOW 0x07
- RED 0x09
- WHITE 0x0A