If you're writing a
GtkWidget subclass, the correct way to obtain a
colormap is with
gtk_widget_get_colormap() (see the chapter called Writing a GtkWidget). Otherwise,
the system (default) colormap is usually what you want;
call
gdk_colormap_get_system(), which takes no
arguments and returns the default colormap.
The GdkRGB module (see
the section called RGB Buffers) is another
way to deal with colors; among other capabilities, it
can set the foreground and background colors of a
graphics context from an RGB value. The relevant
functions are
gdk_rgb_gc_set_foreground() and gdk_rgb_gc_set_background(). GdkRGB has
a pre-allocated colormap that it uses to pick a
best-match color; using it means that your application
can share limited colormap resources with other
applications using GdkRGB (such as the Gimp). You can
also obtain GdkRGB's colormap and use it directly (see
the section called
RGB Buffers).