+static xcb_pixmap_t do_alloc_color(uint32_t rgb)
+{
+ uint16_t r = (rgb & 0xFF0000) >> 8;
+ uint16_t g = (rgb & 0x00FF00);
+ uint16_t b = (rgb & 0x0000FF) << 8;
+ xcb_alloc_color_cookie_t cookie =
+ xcb_alloc_color(conn, colormap, r, g, b);
+ if (!cookie.sequence)
+ return warn("do_alloc_color: bad cookie");
+
+ xcb_alloc_color_reply_t *reply =
+ xcb_alloc_color_reply(conn, cookie, NULL);
+ if (!reply)
+ return warn("do_alloc_color: no reply");
+
+ printf("do_alloc_color: %06x -> %06x\n", rgb, reply->pixel);
+ return reply->pixel;
+}
+