Trying to understand how to use colors with Xlib
Hello! As the topic says, i'm trying to understand how to use colors in Xlib programming. What I think I understand so far is that modern displays use 24 or 32-bit TrueColor. And TrueColor uses three colormaps, one for each primary color, and a single pixel value is composed of three indices.
Now the part i'm confused about is how to get my programs to use a 32-bit TrueColor visual. I thought I could inheret the visual from the root window to get color but it seems no matter what pixel value I use it's either black or white.
I guess my question is, how can I setup my programs so that I can specify a pixel value that is a combination of RGB values to get the color I want?
I come from windows where I simply used RGB(r,g,b) macro to specify colors and never had to worry about depth and colormaps and visuals, so I'm a bit overwhelmed by all of these concepts. So if anyone can clear some of this up for me I would greatly appreciate it!!
|