Skip to content

Commit

Permalink
fix: adapt color scheme to work in dark mode (close #92)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jul 30, 2021
1 parent 94525d0 commit 4c5df52
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 19 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
2.6.8
- fix: adapt color scheme to work in dark mode (#92)
2.6.7
- fix: correctly handle missing features on data export (#80)
- ref: cleanup (default arguments and PyQt5 object references)
Expand Down
2 changes: 1 addition & 1 deletion shapeout2/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@


# global plotting configuration parameters
pg.setConfigOption("background", "w")
pg.setConfigOption("background", None)
pg.setConfigOption("foreground", "k")
pg.setConfigOption("antialias", True)
pg.setConfigOption("imageAxisOrder", "row-major")
Expand Down
6 changes: 3 additions & 3 deletions shapeout2/gui/matrix/dm_dataset.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>94</width>
<height>110</height>
<height>111</height>
</rect>
</property>
<property name="sizePolicy">
Expand All @@ -26,7 +26,7 @@
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color:#C3C9FF</string>
<string notr="true">background-color:#C3C9FF; color:black</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
Expand Down Expand Up @@ -233,7 +233,7 @@
<item>
<widget class="QCheckBox" name="checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down
4 changes: 2 additions & 2 deletions shapeout2/gui/matrix/dm_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ def update_content(self, quickview=False):
else:
tooltip += "\nShift+Click for Quick View"

self.setStyleSheet("background-color:{}".format(color))
self.label.setStyleSheet("background-color:{}".format(color))
self.label.setText(label)
self.setToolTip(tooltip)
self.label.setToolTip(tooltip)
self.setStyleSheet(
"background-color:{};color:black".format(color))
2 changes: 1 addition & 1 deletion shapeout2/gui/matrix/dm_element.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color:#EFEFEF</string>
<string notr="true">background-color:#EFEFEF; color:black</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
Expand Down
4 changes: 2 additions & 2 deletions shapeout2/gui/matrix/dm_filter.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color:#E7E186</string>
<string notr="true">background-color:#E7E186; color:black</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
Expand Down Expand Up @@ -169,7 +169,7 @@
<item alignment="Qt::AlignVCenter">
<widget class="QCheckBox" name="checkBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand Down
4 changes: 2 additions & 2 deletions shapeout2/gui/matrix/pm_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def update_content(self, quickview=False):
label = "inactive\n(unused)"
tooltip = "Click to activate"

self.setStyleSheet("background-color:{}".format(color))
self.label.setStyleSheet("background-color:{}".format(color))
self.label.setText(label)
self.setToolTip(tooltip)
self.label.setToolTip(tooltip)
self.setStyleSheet(
"background-color:{};color:black".format(color))
2 changes: 1 addition & 1 deletion shapeout2/gui/matrix/pm_plot.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color:#86B5E7</string>
<string notr="true">background-color:#86B5E7; color:black</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
Expand Down
7 changes: 7 additions & 0 deletions shapeout2/gui/pipeline_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def update_content(self):
# clear widget
self.plot_layout.clear()

# set background to white
self.plot_layout.setBackground("w")

if not slot_states:
return

Expand Down Expand Up @@ -238,6 +241,8 @@ def __init__(self, *args, **kwargs):
self.axes_to_front()
# Keep track of all elements (for redraw)
self._plot_elements = []
# Set background to white (for plot export)
self.vb.setBackgroundColor("w")

def perform_export(self, file):
"""Performs export in new layout with axes labels set
Expand Down Expand Up @@ -347,6 +352,7 @@ def redraw(self, dslist, slot_states, plot_state):
add_label(text="{} events".format(len(sct[0].data)),
anchor_parent=self.axes["right"]["item"],
font_size_diff=-1,
color="black",
text_halign="right",
text_valign="top",
dx=2,
Expand All @@ -358,6 +364,7 @@ def redraw(self, dslist, slot_states, plot_state):
# only a contour plot
self.setTitle("") # fake title
add_label(text="Contours",
color="black",
anchor_parent=self.titleLabel.item,
text_halign="center",
text_valign="top",
Expand Down
5 changes: 1 addition & 4 deletions shapeout2/gui/quick_view/qv_main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@
<height>300</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color:#FFFFFF</string>
</property>
</widget>
</item>
<item>
Expand Down Expand Up @@ -567,7 +564,7 @@
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
<string notr="true">background-color:transparent</string>
</property>
</widget>
</item>
Expand Down
4 changes: 1 addition & 3 deletions shapeout2/gui/quick_view/qv_style.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
QGroupBox {
border: 1px solid #E0E0E0;
background-color: white;
border-radius: 0px;
margin-top: 1em;
}

QGroupBox::title {
background-color: transparent;
padding-top: -2.5em;
padding-top: -1.5em;
padding-left: 0px;
}

0 comments on commit 4c5df52

Please sign in to comment.