getcolors_gtk3.py 967 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import gi
  4. gi.require_version('Gtk', '3.0')
  5. from gi.repository import Gtk
  6. win = Gtk.Window()
  7. #~ win.connect("delete-event", Gtk.main_quit)
  8. #~ win.show_all()
  9. #~ Gtk.main()
  10. style_context = win.get_style_context()
  11. print(style_context)
  12. print(style_context.lookup_color('bg_color')) # if this worked i'd still need to get a list of valid attributes
  13. #~ def dump(obj):
  14. #~ for attr in dir(obj):
  15. #~ if hasattr( obj, attr ):
  16. #~ print( "obj.%s = %s" % (attr, getattr(obj, attr)))
  17. #~ dump(style_context)
  18. #~ from pprint import pprint
  19. #~ pprint(style_context)
  20. #~ win.connect("delete-event", Gtk.main_quit)
  21. #~ win.show_all()
  22. #~ Gtk.main()
  23. #~ win.realize()
  24. #~ settings=Gtk.Settings.get_default()
  25. #~ colors=settings.get_property("gtk-color-scheme")
  26. #~ colors=colors.split("\n")
  27. #~ for color in colors:
  28. #~ if 'text' in color:
  29. #~ text_color=color.split(':')[1].strip()
  30. #~ print(text_color)
  31. #~ break