diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index ad4d1c0ca59..81f993bf1ce 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -558,6 +558,9 @@ def onrequest(url): stylesheet_string = pattern.sub("", stylesheet_string) + if 'dark' in stylesheet: + app.setProperty('darkMode', True) + else: log.info("%r style sheet not found.", stylesheet) diff --git a/Orange/widgets/data/__init__.py b/Orange/widgets/data/__init__.py index 26a3816dc4c..5e3c3862d8e 100644 --- a/Orange/widgets/data/__init__.py +++ b/Orange/widgets/data/__init__.py @@ -1,3 +1,4 @@ + NAME = "Data" ID = "orange.widgets.data" @@ -12,6 +13,15 @@ ICON = "icons/Category-Data.svg" -BACKGROUND = "#FFD39F" +from AnyQt.QtGui import QPalette + +BACKGROUND = { + 'light': { + QPalette.Light: '#febc57', + QPalette.Midlight: '#fe9457', + QPalette.Button: '#fe9057', + }, + 'plain': "#FFD39F", +} PRIORITY = 1 diff --git a/Orange/widgets/evaluate/__init__.py b/Orange/widgets/evaluate/__init__.py index b19110dba1e..38c479dc53f 100644 --- a/Orange/widgets/evaluate/__init__.py +++ b/Orange/widgets/evaluate/__init__.py @@ -2,11 +2,21 @@ Widgets from Evaluate category """ + NAME = "Evaluate" DESCRIPTION = "Evaluate classification/regression performance." -BACKGROUND = "#C3F3F3" +from AnyQt.QtGui import QPalette + +BACKGROUND = { + 'light': { + QPalette.Light: '#a5ebeb', + QPalette.Midlight: '#5cebeb', + QPalette.Button: '#4be3f2', + }, + 'plain': "#C3F3F3", +} ICON = "icons/Category-Evaluate.svg" diff --git a/Orange/widgets/model/__init__.py b/Orange/widgets/model/__init__.py index d43d24dd36d..5693e3f8cdb 100644 --- a/Orange/widgets/model/__init__.py +++ b/Orange/widgets/model/__init__.py @@ -4,7 +4,16 @@ DESCRIPTION = 'Prediction.' -BACKGROUND = '#FAC1D9' +from AnyQt.QtGui import QPalette + +BACKGROUND = { + 'light': { + QPalette.Light: '#ffbddb', + QPalette.Midlight: '#ff8dc6', + QPalette.Button: '#f175b6', + }, + 'plain': "#FAC1D9", +} ICON = 'icons/Category-Model.svg' diff --git a/Orange/widgets/unsupervised/__init__.py b/Orange/widgets/unsupervised/__init__.py index 912138e530e..f8c4cb96834 100644 --- a/Orange/widgets/unsupervised/__init__.py +++ b/Orange/widgets/unsupervised/__init__.py @@ -13,7 +13,16 @@ DESCRIPTION = "Unsupervised learning." -BACKGROUND = "#CAE1EF" +from AnyQt.QtGui import QPalette + +BACKGROUND = { + 'light': { + QPalette.Light: '#aed2d9', + QPalette.Midlight: '#5abced', + QPalette.Button: '#499fd8', + }, + 'plain': "#CAE1EF", +} ICON = "icons/Category-Unsupervised.svg" diff --git a/Orange/widgets/visualize/__init__.py b/Orange/widgets/visualize/__init__.py index ff3394c681d..547405a34c0 100644 --- a/Orange/widgets/visualize/__init__.py +++ b/Orange/widgets/visualize/__init__.py @@ -15,7 +15,16 @@ DESCRIPTION = "Widgets for data visualization." -BACKGROUND = "#FFB7B1" +from AnyQt.QtGui import QPalette + +BACKGROUND = { + 'light': { + QPalette.Light: '#f2b6b8', + QPalette.Midlight: '#ff8a99', + QPalette.Button: '#ff7a8a', + }, + 'plain': "#FFB7B1", +} ICON = "icons/Category-Visualize.svg" diff --git a/Orange/widgets/visualize/owscatterplotgraph.py b/Orange/widgets/visualize/owscatterplotgraph.py index 1110a44393e..d3f28db9854 100644 --- a/Orange/widgets/visualize/owscatterplotgraph.py +++ b/Orange/widgets/visualize/owscatterplotgraph.py @@ -8,7 +8,7 @@ import numpy as np from AnyQt.QtCore import Qt, QRectF, QSize, QTimer, pyqtSignal as Signal, \ - QObject + QObject, QEvent from AnyQt.QtGui import QColor, QPen, QBrush, QPainterPath, QTransform, \ QPainter from AnyQt.QtWidgets import QApplication, QToolTip, QGraphicsTextItem, \ @@ -568,8 +568,7 @@ def __init__(self, scatter_widget, parent=None, view_box=ViewBox): self.view_box = view_box(self) _axis = {"left": AxisItem("left"), "bottom": AxisItem("bottom")} - self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent, - background="w", axisItems=_axis) + self.plot_widget = pg.PlotWidget(viewBox=self.view_box, parent=parent, axisItems=_axis) self.plot_widget.hideAxis("left") self.plot_widget.hideAxis("bottom") self.plot_widget.getPlotItem().buttonsHidden = True diff --git a/Orange/widgets/visualize/utils/widget.py b/Orange/widgets/visualize/utils/widget.py index 0f00929e0ad..c59478a109f 100644 --- a/Orange/widgets/visualize/utils/widget.py +++ b/Orange/widgets/visualize/utils/widget.py @@ -2,10 +2,12 @@ import numpy as np -from AnyQt.QtCore import QSize, Signal +from AnyQt.QtCore import QSize, Signal, QEvent, Qt from AnyQt.QtWidgets import QApplication +from PyQt5.QtGui import QPalette, QPen from orangewidget.utils.visual_settings_dlg import VisualSettingsDialog +from pyqtgraph import AxisItem from Orange.data import ( Table, ContinuousVariable, Domain, Variable, StringVariable @@ -412,6 +414,7 @@ def __init__(self): def setup_gui(self): self._add_graph() self._add_controls() + # self._update_palette() self.input_changed.emit(None) self.output_changed.emit(None) @@ -663,6 +666,29 @@ def onDeleteWidget(self): self.graph.plot_widget.clear() self.graph.clear() + # def changeEvent(self, event): + # if event.type() == QEvent.PaletteChange: + # self._update_palette() + # super().changeEvent(event) + # + # def _update_palette(self): + # palette: QPalette = self.palette() + # brush = palette.base() + # text_color = palette.color(QPalette.WindowText) + # + # self.graph.update_colors() # TODO? + # self.graph.plot_widget.setBackground(brush) + # self.graph.tip_textitem.setDefaultTextColor(Qt.black) + # + # pen = QPen(text_color) + # + # plotItem = self.graph.plot_widget.plotItem + # plotItem.titleLabel.setText(brush.color().name()) + # for name in plotItem.axes: + # a: AxisItem = plotItem.getAxis(name) + # a.setPen(pen) + # a.setTextPen(pen) + class OWAnchorProjectionWidget(OWDataProjectionWidget, openclass=True): """ Base widget for widgets with graphs with anchors. """