Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.1.9, and 1.1.9.1

stable gtklib: GTK version safe color detection

Changeset a6e409b31fdb

Parent 66fb6e2ff598

by Steve Borho

Changes to one file · Browse files at a6e409b31fdb Showing diff from parent 66fb6e2ff598 Diff from another changeset...

 
199
200
201
 
 
 
 
 
 
 
 
 
 
202
203
204
 
207
208
209
210
 
 
 
 
 
211
212
213
 
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
 
217
218
219
 
220
221
222
223
224
225
226
227
@@ -199,6 +199,16 @@
  ( 1.0, 0.0, 1.0 ),   ]   +def get_gtk_colors(): + color_scheme = gtk.settings_get_default().get_property('gtk-color-scheme') + colors = {} + for color in color_scheme.split('\n'): + color = color.strip() + if color: + name, color = color.split(':') + colors[name.strip()] = gtk.gdk.color_parse(color.strip()) + return colors +  def get_gtk_text_color():   w = gtk.Window()   w.realize() @@ -207,7 +217,11 @@
   def is_dark_theme():   global NORMAL, MAINLINE_COLOR - normal = gtk.gdk.color_parse(get_gtk_text_color()) + if gtk.pygtk_version < (2, 12, 0): + gtk_colors = get_gtk_colors() + normal = gtk_colors.get('fg_color', gtk.gdk.color_parse('black')) + else: + normal = gtk.gdk.color_parse(get_gtk_text_color())   NORMAL = str(normal)   MAINLINE_COLOR = (   normal.red / 65535.0,