- User Interfaces
- Other User Interfaces
- Programmer info: Change system theme color into dark with 3 lines of python code
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
Programmer info: Change system theme color into dark with 3 lines of python code was created by Grotius
Example normal system theme colors :
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 :
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
self.data.system_theme = 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'
self.data.local_theme = 'Link to %s_theme'% self.skinname
# make ~/.themes - quietly ignore the error if it exists
try:
os.makedirs(userthemedir)
except OSError as exception:
if exception.errno != errno.EEXIST:
raise
# create systemlink because one can't store themes in an arbitrary folder.
if not os.path.exists(userthemedir+'/%s'%self.data.local_theme):
os.symlink(localtheme,userthemedir+'/%s'%self.data.local_theme)
settings = gtk.settings_get_default()
settings.set_string_property("gtk-theme-name", self.data.local_theme, "")
else:
self.data.local_theme = 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
Replied by cmorley on topic Programmer info: Change system theme color into dark with 3 lines of python code
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
Some CNC themes are not suitable for the system.
Chris M
Please Log in or Create an account to join the conversation.
- User Interfaces
- Other User Interfaces
- Programmer info: Change system theme color into dark with 3 lines of python code
Time to create page: 0.126 seconds