Re: [Vala] Gtk Custom widget: drawing with "gtk theme" colours



Cheers for the XFCE link, didnt know they were doing tut's these days!

I got the following vala code to work:

unowned Gtk.Style style = this.get_style();
// color.<x>  is a uint16: divide by 65535.0 to get 0-1 range
Gdk.Color color = style.bg[0];
cr.set_source_rgb(color.red/65535.0, color.green/65535.0,
color.blue/65535.0);

probably not the nicest code ever, but it gets the job done.

Gdk.cairo_set_source_color(some_cairo_context, some_gdk_color);   // taken
from the XFCE tutorial

That's a nice convenience function, but I dont really like the non-OOP
style...
Each to their own sure!
-Harry

On Thu, Jul 22, 2010 at 7:20 PM, Mike Massonnet <mmassonnet gmail com>wrote:

Hi,

2010/7/21 Harry Van Haaren <harryhaaren gmail com>:
Hey All,

I've designed a couple of widgets now, (in various languanges: python C++
Vala)
and googled for many tutorials regarding how to draw custom widgets in
the
GTK theme
colours. I havent found any example code, or tutorial yet...

I hope somebody has a pointer on how I can "extract" the colours from the
current theme?

http://wiki.xfce.org/howto/monochrome-icon#gtk_colors

HTH,
Mike

Cheers, -Harry



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]