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

Better handling of "Dark Mode" #899

Open
corranwebster opened this issue May 12, 2023 · 0 comments
Open

Better handling of "Dark Mode" #899

corranwebster opened this issue May 12, 2023 · 0 comments

Comments

@corranwebster
Copy link
Contributor

Problem Description

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

image

Reproduction Steps:

The is produced by this code:

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant