x11rb::protocol::xproto

Function alloc_color

Source
pub fn alloc_color<Conn>(
    conn: &Conn,
    cmap: Colormap,
    red: u16,
    green: u16,
    blue: u16,
) -> Result<Cookie<'_, Conn, AllocColorReply>, ConnectionError>
where Conn: RequestConnection + ?Sized,
Expand description

Allocate a color.

Allocates a read-only colormap entry corresponding to the closest RGB value supported by the hardware. If you are using TrueColor, you can take a shortcut and directly calculate the color pixel value to avoid the round trip. But, for example, on 16-bit color setups (VNC), you can easily get the closest supported RGB value to the RGB value you are specifying.

§Fields

  • cmap - TODO
  • red - The red value of your color.
  • green - The green value of your color.
  • blue - The blue value of your color.

§Errors

  • Colormap - The specified colormap cmap does not exist.