I know this is a pretty specific topic -- but I know a few of you have programmed GTK, and it's a pretty simple question.
I am trying to code in some widget background colors in RGB. My display is 8x3=24bit truecolor. My version of GTK/GDK is processing my colors through what looks like a 256 color palette -- so they come out looking utterly ridiculous.
Q: does GTK/GDK always use a palette, and play the "closest match to requested color" game? Or is it a fluke that it's using a palette on my truecolor display?
Colors in GTK+
Re: Colors in GTK+
What code are you using? I have a 24bit true color display (At least that is what Gdk seems to think.), and I have no problems making an orange button with:
You can check what your GTK is using by getting your GdkVisual:
Hope that helps, if only a little.
-Alboin
Note: With a truecolor, the visual->colormap_size is always 256. Don't be alarmed. In a sense, this means the answer to your question is "no", in that GTK somewhat 'ignores' the palette, setting it to 256, when it has a truecolor display.
Code: Select all
GdkColor color;
color.red = 60000;
color.blue = 0;
color.green = 30000;
gtk_widget_modify_bg(button, GTK_STATE_NORMAL, &color);
Code: Select all
GdkColormap *map = gdk_colormap_get_system();
GdkVisual *visual = gdk_colormap_get_visual(map);
printf("%i\n", visual->depth);
...
-Alboin
Note: With a truecolor, the visual->colormap_size is always 256. Don't be alarmed. In a sense, this means the answer to your question is "no", in that GTK somewhat 'ignores' the palette, setting it to 256, when it has a truecolor display.
C8H10N4O2 | #446691 | Trust the nodes.
Re: Colors in GTK+
Thank you. It prints a depth of 24, and your code works.
I had created a macro to make the "transition" from Win32 to GTK easier. But the first reference that I saw had the GdkColor elements in the wrong order, so my macro creates the elements wrong. It was easy to fix, once your code showed me what to check!
I had created a macro to make the "transition" from Win32 to GTK easier. But the first reference that I saw had the GdkColor elements in the wrong order, so my macro creates the elements wrong. It was easy to fix, once your code showed me what to check!