XcmsStoreColor(3)
β¨ XcmsStoreColor β like, the whole manual page bestie β¨
okay so this is XcmsStoreColor(3) from the XLIB FUNCTIONS fam, and we're about to get into it. setting colors, storing colors, the whole vibe. buckle up π
πΈ NAME πΈ
XcmsStoreColor, XcmsStoreColors β set colors. that's literally it. setting colors. iconic behavior tbh.
β¨ SYNTAX β¨
Status XcmsStoreColor(Display *display, Colormap colormap, XcmsColor
*color);
Status XcmsStoreColors(Display *display, Colormap colormap, XcmsColor
*colors, unsigned ncolors, Bool *compression_flags_return);
π ARGUMENTS π
displayβ specifies the connection to the X server. your link to the mothership, basically πΈcolorβ specifies the color cell and the color to store in it. and listen, the values you put into thisXcmsColorstructure stay unchanged when the function returns. no cap, it leaves your struct alone.colorsβ specifies the color specification array ofXcmsColorstructures, each one specifying a color cell and the color to store there. and again, the values in the array remain unchanged upon return. she respects your data πcolormapβ specifies the colormap. the map. of colors. you get it.compression_flags_returnβ returns an array ofBooleanvalues showing compression status. if you hand her a non-NULLpointer, each element gets set toTrueif the corresponding color was compressed andFalseif it wasn't. and if compression status isn't useful to you? just passNULL. she won't be offended π«Άncolorsβ specifies how manyXcmsColorstructures live in the color-specification array. just a count. a cute little number.
π¦ DESCRIPTION π¦
π XcmsStoreColor (the singular one)
so XcmsStoreColor takes the color you specified in the XcmsColor structure and converts it into RGB values. then it takes that RGB specification, drops it into an XColor structure (with all three flags β DoRed, DoGreen, and DoBlue β set, as they must be), and hands it to XStoreColor to change the color cell specified by the pixel member of the XcmsColor structure.
now here's the catch, bestie, and it's giving important:
- that
pixelvalue must be a valid index for the specified colormap, and the color cell it points to must be a read/write cell. - if the pixel value is not a valid index β
BadValueerror. periodt. - if the color cell is unallocated or is allocated read-only β
BadAccesserror. π - if the colormap is an installed map for its screen, the changes are visible immediately. instant gratification, we love to see it.
β οΈ okay so real talk:XStoreColorhas no return value. none. so ifXcmsStoreColorhands you backXcmsSuccess, all that actually means is that the conversion to RGB succeeded and the call toXStoreColorwas made. that's it. to get the actual color that got stored, useXcmsQueryColor. and because of the screen's hardware limitations or gamut compression, the color that ends up in the colormap may not be identical to the color you specified. she tries her best but hardware is hardware π
XcmsStoreColor can generate BadAccess, BadColor, and BadValue errors.
π XcmsStoreColors (the plural one, yes there are two)
XcmsStoreColors takes the colors in that array of XcmsColor structures, converts them all to RGB values, and then uses those RGB specifications in XColor structures (three flags β DoRed, DoGreen, and DoBlue β set, obviously) in a call to XStoreColors to change the color cells specified by the pixel member of the corresponding XcmsColor structure.
the rules, again, because repetition is how we learn:
- each pixel value must be a valid index for the specified colormap, and the color cell each one points to must be a read/write cell.
- if a pixel value is not a valid index β
BadValueerror. - if a color cell is unallocated or is allocated read-only β
BadAccesserror. - if more than one pixel is in error? the one that gets reported is arbitrary. yeah, she picks. no promises on which one. π
- if the colormap is an installed map for its screen, the changes are visible immediately.
β οΈ same deal as before:XStoreColorshas no return value. so anXcmsSuccessfromXcmsStoreColorsjust means the conversions to RGB succeeded and the call toXStoreColorswas made. to obtain the actual colors stored, useXcmsQueryColors. and again β hardware limitations or gamut compression means the colors stored in the colormap may not be identical to the ones you specified. it's giving "close enough" energy, and honestly? same.
XcmsStoreColors can generate BadAccess, BadColor, and BadValue errors.
π DIAGNOSTICS π
BadAccessβ a client attempted to free a color map entry that it did not already allocate. rude. not yours, don't touch. πBadAccessβ a client attempted to store into a read-only color map entry. read-only means read-only bestie, it's right there in the name πBadColorβ a value for aColormapargument does not name a definedColormap. that colormap? doesn't exist. she's not in the system. ghosted.BadValueβ some numeric value falls outside the range of values accepted by the request. and unless a specific range is specified for an argument, the full range defined by the argument's type is accepted. also, any argument defined as a set of alternatives can generate this error. basically: check your numbers, babe π₯
π SEE ALSO π
XcmsAllocColor(3)XcmsQueryColor(3)Xlib - C Language X Interface
like, go read those too, they're literally part of the lore π
okay that's the whole page and honestly? she ate. π
sign-off time: this gorgeous little manual is from X Version 11, libX11 1.8.14, and it's dated as such β so if you're out here storing colors with some other version, check yourself before you wreck yourself. mwah π
π¦ where this page comes from
- alpine 3.24: libx11-doc 1.8.14-r0 Β· X11
- arch rolling: libx11 1.8.14-1 Β· MIT AND X11
- nixos 26.05: libx11 1.8.14
- nixpkgs unstable: libx11 1.8.14
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms