/usr/lib/curses.h
http://www.unet.univie.ac.at/aix/aixprggd/genprogc/manip_video_attrs.htm

init_pair(1, COLOR_BLACK, COLOR_CYAN);

You could then set the attributes for the window as:

wattrset(win, COLOR_PAIR(1));

----------

ideas: 
if the attribute is a color ...

use bgcolor and fgcolor to hold current values instead of | they just
replace when you get to them

/* Usage notes
it has a color if 		(attr&OWL_FMTEXT_ATTR_COLOR != 0)
get the foreground color 	(attr&OWL_FMTEXT_ATTR_FG_COLOR)
get the background coloe	(attr&OWL_FMTEXT_ATTR_BG_COLOR)

to remove a foreground color	attr ^= (attr&OWL_FMTEXT_ATTR_FG_COLOR)
to remove a backgroung color	attr ^= (attr&OWL_FMTEXT_ATTR_BG_COLOR)

new fg attr = ((attr&OWL_FMTEXT_ATTR_FG_COLOR)^attr) | new_color;

if (!strcmp(color,"blue")) {
    new_color = OWL_FMTEXT_FG_BLUE;
} else if (!strcmp(color,"red")) {
    new_color = OWL_FMTEXT_FG_RED;
} ......

# use xor to remove any old color then add the new one
if (new_color&OWL_FMTEXT_FG_COLOR) {
            attr = ((attr&OWL_FMTEXT_ATTR_FG_COLOR)^attr) | new_color;
} else if (new_color&OWL_FMTEXT_BG_COLORED) {
    attr = ((attr&OWL_FMTEXT_ATTR_BG_COLOR)^attr) | new_color;
}

*/


not cheating on creating colors, but it doesn't work, pair_content
doesn't seem to DTRT .....
*inverse = 0;
  for (i=1; i<=g->num_colors; i++) {
    if (i == COLOR_PAIRS) {
      /* all color slots are full, skip this one */
      i=0;
      break;
    } else {
      if (pair_content(i, &tmp_fg, &tmp_bg)) {
        if (tmp_fg == c_fg && tmp_bg == c_bg) {
          /* found the right color */
          break;
        } else if (tmp_fg == c_bg && tmp_bg == c_fg) {
          /* found reversed color, set inverse */
          *inverse = 1;
          break;
        }
      } else {
        /* found an unused color slot */
        init_pair(i, c_fg, c_bg);
        break;
      }
    }
  }

  
