Warning
gdk_rgb_find_color has been deprecated since version 2.22 and should not be used in newly-written code. Cairo handles colors automatically.
colormap should be the colormap for the graphics context and
drawable you're using to draw. If you're drawing to a GtkWidget,
call gtk_widget_get_colormap().
color should have its red, green, and blue fields initialized;
gdk_rgb_find_color() will fill in the pixel field with the best
matching pixel from a color cube. The color is then ready to be
used for drawing, e.g. you can call gdk_gc_set_foreground() which
expects pixel to be initialized.
In many cases, you can avoid this whole issue by calling
gdk_gc_set_rgb_fg_color() or gdk_gc_set_rgb_bg_color(), which
do not expect pixel to be initialized in advance. If you use those
functions, there's no need for gdk_rgb_find_color().
Warning gdk_rgb_find_color has been deprecated since version 2.22 and should not be used in newly-written code. Cairo handles colors automatically. colormap should be the colormap for the graphics context and drawable you're using to draw. If you're drawing to a GtkWidget, call gtk_widget_get_colormap(). color should have its red, green, and blue fields initialized; gdk_rgb_find_color() will fill in the pixel field with the best matching pixel from a color cube. The color is then ready to be used for drawing, e.g. you can call gdk_gc_set_foreground() which expects pixel to be initialized. In many cases, you can avoid this whole issue by calling gdk_gc_set_rgb_fg_color() or gdk_gc_set_rgb_bg_color(), which do not expect pixel to be initialized in advance. If you use those functions, there's no need for gdk_rgb_find_color().