Programmer info: Change system theme color into dark with 3 lines of python code

01 Aug 2018 18:13 - 01 Aug 2018 18:17 #115332 by Grotius
Example normal system theme colors :

import gtk    
self.settings = gtk.settings_get_default()
self.settings.set_property("gtk-theme-name", "Adwaita-dark")

Example after 3 lines of code :

There is no need for this :
themedir = "/usr/share/themes"
userthemedir = os.path.join(os.path.expanduser("~"), ".themes")

In Gscreen this code is for changing system theme, Gmoccapy uses almost the same code :
# get the system wide theme
        settings = gtk.settings_get_default()
        settings.props.gtk_button_images = True = settings.get_property("gtk-theme-name")
        # check for a local theme gtkrc file
        localtheme = os.path.join(CONFIGPATH,'%s_theme'%self.skinname)
        if os.path.exists(localtheme):
            print 'local theme path found'
   = 'Link to %s_theme'% self.skinname
            # make ~/.themes - quietly ignore the error if it exists
            except OSError as exception:
                if exception.errno != errno.EEXIST:
            # create systemlink because one can't store themes in an arbitrary folder.
            if not os.path.exists(userthemedir+'/%s'
            settings = gtk.settings_get_default()
            settings.set_string_property("gtk-theme-name",, "")
   = None
Last edit: 01 Aug 2018 18:17 by Grotius.
The following user(s) said Thank You: tommylight, rodw

Please Log in or Create an account to join the conversation.

02 Aug 2018 03:11 #115368 by cmorley
This is because Gscreen and Gmoccapy allow you to have your special theme in the config folder rather then the system folder.
Some CNC themes are not suitable for the system.

Chris M

Please Log in or Create an account to join the conversation.

Time to create page: 0.104 seconds
Powered by Kunena Forum