xcb_alloc_named_color(3)

πŸ“¦
version 1.17.0 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– xcb_alloc_named_color β€” a lil XCB Requests page, bestie πŸ’–

okay so. this is xcb_alloc_named_color(3), from the XCB Requests family, and it's literally the request that goes "hey X11 server, i have a color name and i want a pixel for it." yes she's giving ✨named color allocation✨. sit down, hydrate, let's go πŸ“


✨ SYNOPSIS ✨

first things first, you gotta pull in the header:

#include <xcb/xproto.h>

πŸŽ€ Request function

xcb_alloc_named_color_cookie_t
       xcb_alloc_named_color(xcb_connection_t *conn,
       xcb_colormap_t cmap, uint16_t name_len, const char *name);

πŸ¦‹ Reply datastructure

typedef struct xcb_alloc_named_color_reply_t {
    uint8_t  response_type;
    uint8_t  pad0;
    uint16_t sequence;
    uint32_t length;
    uint32_t pixel;
    uint16_t exact_red;
    uint16_t exact_green;
    uint16_t exact_blue;
    uint16_t visual_red;
    uint16_t visual_green;
    uint16_t visual_blue;
} xcb_alloc_named_color_reply_t;

🌸 Reply function

xcb_alloc_named_color_reply_t
       *xcb_alloc_named_color_reply(xcb_connection_t *conn,
       xcb_alloc_named_color_cookie_t cookie, xcb_generic_error_t **e);

πŸ’… REQUEST ARGUMENTS πŸ’…

  • conn β€” your XCB connection to X11, aka the whole entire reason any of this works. the group chat line to the server, if you will 🫢
  • cmap β€” TODO: NOT YET DOCUMENTED. yeah bestie the docs just... didn't. iconic of them tbh 😭
  • name_len β€” TODO: NOT YET DOCUMENTED. no thoughts, head empty πŸ’€
  • name β€” TODO: NOT YET DOCUMENTED. the mystery continues πŸ•΅οΈ

🌈 REPLY FIELDS 🌈

  • response_type β€” the type of this reply, and in this case it's XCB_ALLOC_NAMED_COLOR. this field also lives in the xcb_generic_reply_t, so you can use it to tell replies apart from each other. she's the little name tag at the party πŸŽ€
  • sequence β€” the sequence number of the last request processed by the X11 server. like a lil receipt number fr fr 🧾
  • length β€” the length of the reply, in words. and before you ask: a word is 4 bytes. no cap πŸ“
  • pixel β€” TODO: NOT YET DOCUMENTED. 🫠
  • exact_red β€” TODO: NOT YET DOCUMENTED. πŸ’”
  • exact_green β€” TODO: NOT YET DOCUMENTED. πŸ’š
  • exact_blue β€” TODO: NOT YET DOCUMENTED. πŸ’™
  • visual_red β€” TODO: NOT YET DOCUMENTED. πŸ‘€
  • visual_green β€” TODO: NOT YET DOCUMENTED. πŸ‘€
  • visual_blue β€” TODO: NOT YET DOCUMENTED. πŸ‘€

🧚 DESCRIPTION 🧚

so... this section is empty in the original. like, actually empty. nothing. void. the audacity 😭 no description for you bestie, go read the reply fields i guess πŸ¦‹


⭐ RETURN VALUE ⭐

she hands you back an xcb_alloc_named_color_cookie_t πŸͺ and β€” important β€” errors have to be handled when you call the reply function xcb_alloc_named_color_reply.

ok but what if you'd rather handle errors in the event loop instead?? then use xcb_alloc_named_color_unchecked, periodt. see xcb-requests(3) for the deets πŸ“–

πŸ’€ ERRORS πŸ’€

this request does never generate any errors. not one. zero. she's a good girl, she behaves πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘

(same energy as DESCRIPTION tbh β€” there's nothing listed here in the original. empty. nada. moving on ✨)


πŸ™ˆ AUTHOR πŸ™ˆ

Generated from xproto.xml. Contact xcb@lists.freedesktop.org for corrections and improvements. (so if something's wrong, that's who you @ in the group chat πŸ“§)


and that's the whole page!! this came to you from X Version 11 and libxcb 1.17.0, filed under xcb_alloc_named_color(3). bye bestie, go allocate some named colors responsibly πŸ’œβœ¨πŸŽ€