Skip to content

Commit

Permalink
Change colour parsing in plot_1d_model
Browse files Browse the repository at this point in the history
  • Loading branch information
MBartkowiakSTFC committed Mar 25, 2024
1 parent f6de82b commit 120466f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions MDANSE_GUI/Src/MDANSE_GUI/Plotter/models/plot_1d_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,10 @@ def data(self, index, role):
elif role == QtCore.Qt.ItemDataRole.ForegroundRole:
matplotlib_color = line.get_color()
try:
color = matplotlib_color.lstrip("#")
r, g, b = tuple(int(color[i : i + 2], 16) / 255.0 for i in (0, 2, 4))
except AttributeError:
color = QtGui.QColor(matplotlib_color)
except TypeError:
r, g, b = matplotlib_color
finally:
color = QtGui.QColor(r * 255, g * 255, b * 255)
color = QtGui.QColor(int(r * 255), int(g * 255), int(b * 255))
return color

elif role == Plot1DModel.LineRole:
Expand Down

0 comments on commit 120466f

Please sign in to comment.