Thanks for the feedback. Looking further into this i found that ncurses has a global variable named COLORS which holds the maximum number of colors. It would probably be the easiest way to get the number. However as i see it, there are two approaches to this. Should the colors be silently ignored at draw time if the terminal doesn't support it or should they be ignored at load time? Using the COLOR method wouldn't work if it's ignored at load time since the variable isn't populated until after ncurses is initialized and that happens after the rcfile is loaded.
I think that if the nanorc file defines colors in foreground or background that's not supported by the terminal, it should revert back to the standard colors for that section. It would be the safe way of being able to read the text. If a user defines the color black as foreground color and then a greenish extended color as background. If the valid color "black" is used as foreground and the standard terminal background color is black, the text would be unreadable.
I agree with the question marks comment.
Btw, thanks for an awesome editor. I use it daily in both work and at home. :)