Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__main__: Implement basic darkmode provisions #5526

Merged
merged 4 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ def send_statistics(url):
r = requests.post(url, files={'file': json.dumps(data)})
if r.status_code != 200:
log.warning("Error communicating with server while attempting to send "
"usage statistics. Status code " + str(r.status_code))
"usage statistics. Status code %d", r.status_code)
return
# success - wipe statistics file
log.info("Usage statistics sent.")
Expand Down Expand Up @@ -457,6 +457,20 @@ def main(argv=None):
app.setPalette(breeze_dark())
defaultstylesheet = "darkorange.qss"

# set pyqtgraph colors
def onPaletteChange():
p = app.palette()
bg = p.base().color().name()
fg = p.windowText().color().name()

log.info('Setting pyqtgraph background to %s', bg)
pyqtgraph.setConfigOption('background', bg)
log.info('Setting pyqtgraph foreground to %s', fg)
pyqtgraph.setConfigOption('foreground', fg)

app.paletteChanged.connect(onPaletteChange)
onPaletteChange()

palette = app.palette()
if style is None and palette.color(QPalette.Window).value() < 127:
log.info("Switching default stylesheet to darkorange")
Expand Down Expand Up @@ -560,6 +574,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)

Expand Down
2 changes: 0 additions & 2 deletions Orange/widgets/utils/plot/owpalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
__all__ = ["create_palette", "OWPalette"]


pg.setConfigOption('background', 'w')
pg.setConfigOption('foreground', 'k')
pg.setConfigOptions(antialias=True)


Expand Down