enthought / enthought/chaco

Better handling of "Dark Mode"

Open
#899 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
305
Forks
97
PR merge metrics
No merged PRs in 30d

Description

**Problem Description**

When running on Mac in Dark Mode with recent Qt versions, plots render like this:

![image](https://github.com/enthought/chaco/assets/600761/d64a0501-46a8-49ec-8869-f2f9b1c33942)

**Reproduction Steps:**

The is produced by this code:

```python
from numpy import linspace, sin
from traits.api import HasTraits, Instance
from traitsui.api import View, Item
from chaco.api import Plot, ArrayPlotData
from enable.api import ComponentEditor

class LinePlot(HasTraits):
plot = Instance(Plot)

traits_view = View(
Item('plot', editor=ComponentEditor(), show_label=False),
width=500,
height=500,
resizable=True,
title="Chaco Plot",
)

def _plot_default(self):
x = linspace(-14, 14, 100)
y = sin(x) * x**3
plotdata = ArrayPlotData(x=x, y=y)

plot = Plot(plotdata)
plot.plot(("x", "y"), type="line", color="blue")
plot.title = "sin(x) * x^3"
return plot

if __name__ == "__main__":
LinePlot().configure_traits()
```

**Expected behavior:**

At a minimum we should be defaulting to painting the padded area white so the labels are visible. Better would be to detect the background color of the window and adapt rendering appropriately (which would require a default "dark-mode" palette for all drawing, which is significant work)

**OS, Python version:** MacOS, all Python versions.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.