They don't map to RGB color codes at all.
They generate a square wave of NTSC signal that goes up and down between a high and low voltage level, and the phase of the wave determines the hue.
There's an
article for this on the Nesdev Wiki, which has more information than you ever wanted to know about how NTSC TVs work.
A couple of random illustrations from the wiki:
Code: Select all
1.0 +--+
0.9 | |
0.8 | |
0.7 +--+ | +-+ +-+
0.6 | | | | | |
0.5 | | | | | |
0.4 +--+ | | | | |
0.3 +--+ | | | | |
0.2 | | | | | |
0.1 | | | | | |
0.0 . +--+ . . . . . +-+ +-+ + . .
-0.1 --+
0D 0F 2D 00 10 30 11
So if you want to do all the complicated calculations of converting to the YIQ color space, then to YUV, then finally getting RGB out of that, that's fine. Or you could build of someone else's work. Nintendulator has a very nice NES palette.
If you want to generate NTSC composite video directly, you can make the same square wave patterns that the NES does.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!