Skip to content

Commit

Permalink
Fix preferences css for dark mode
Browse files Browse the repository at this point in the history
ref #150
  • Loading branch information
diegogangl committed Sep 11, 2020
1 parent 8e61052 commit fdd7453
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion GTG/gtk/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def __init__(self, app_id, debug):

self.init_style()


# --------------------------------------------------------------------------
# INIT
# --------------------------------------------------------------------------
Expand Down Expand Up @@ -168,8 +167,14 @@ def toggle_darkmode(self, state=True):
"""Use dark mode theme."""

settings = Gtk.Settings.get_default()
prefs_css = self.preferences_dialog.window.get_style_context()
settings.set_property("gtk-application-prefer-dark-theme", state)

if state:
prefs_css.add_class('dark')
else:
prefs_css.remove_class('dark')

def init_actions(self):
"""Setup actions."""

Expand Down
8 changes: 8 additions & 0 deletions GTG/gtk/data/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,11 @@
.prefs_list row {
border-bottom: solid 1px alpha(currentColor, 0.1);
}

.dark .prefs_list {
border-color: alpha(rgb(0, 0, 0), 0.4);
}

.dark .prefs_list row {
border-bottom-color: alpha(rgb(0, 0, 0), 0.2);
}

0 comments on commit fdd7453

Please sign in to comment.