Feature #1116
openAdd support for styles to pigtk
10%
Updated by Hammel 8 months ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
Once a style is retrieved, a color hex value from the style can be converted to a GdkColor with
gboolean gdk_color_parse (const gchar *spec,
GdkColor *color);
The GdkColor is
struct GdkColor
{
gulong pixel;
gushort red;
gushort green;
gushort blue;
};
The red, green and blue values can be divided by 65535 to get a percentage value that can then be applied to a cairo_set_source_rgba(cr, 1.0, 1.0, 1.0, 1.0) call, as in
cairo_set_source_rgba(cr, color.red/65535, color.green/65535, color.blue/65535, 1.0);
The actual colors to use should be computed from the style either when the _init() function is called (if the style is available then) or from the _expose() call. Appropriate defaults (re: white) should be used if the expected style setting is not found or is not set.
This can be tested with the pigtk app using the -T argument which will load the data/gtkrc file.
Updated by Hammel 8 months ago
- Priority changed from Immediate to Normal
- Severity changed from 02 - High to 03 - Medium
I tried to do this but couldn't get the bg[] and fg[] to get passed through correctly. I was only ever able to pass the red component of the fg color, everything else was never set correctly - or couldn't be used correctly. I never figured it out and it's just not that important for now.
So I'll move this way down the list and maybe come back to it some other time.