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

Unreadable text in input boxes on macOS Mojave (10.14) with dark theme #358

Closed
bgromov opened this issue Nov 10, 2018 · 6 comments
Closed
Milestone

Comments

@bgromov
Copy link

bgromov commented Nov 10, 2018

Cfclient version: 2018.10
System: darwin
Python: 3.7.1
Qt: 5.11.2
PyQt: 5.11.3

OS: macOS Mojave (10.14) with dark theme

The text in the input fields is not readable as it is set to the same color as the background. Here you can see that only the selected text in Address box is readable:
screenshot 2018-11-10 at 13 03 31

The same problem is with Console and Parameters tabs.

Apparently this is a known issue with Qt and should be fixed with the next minor release (5.12.0): https://bugreports.qt.io/browse/QTBUG-68891

I don't know if there is a system-wide solution, but fixing the Qt color palette locally makes the Cfclient usable:

diff --git a/src/cfclient/gui.py b/src/cfclient/gui.py
index 7c0526e..fa83d59 100644
--- a/src/cfclient/gui.py
+++ b/src/cfclient/gui.py
@@ -134,10 +134,15 @@ def main():
     # Start up the main user-interface
     from .ui.main import MainUI
     from PyQt5.QtWidgets import QApplication
-    from PyQt5.QtGui import QIcon
+    from PyQt5.QtGui import QIcon, QPalette, QColor
 
     app = QApplication(sys.argv)
 
+    p = app.palette()
+    p.setColor(QPalette.Base, QColor(101, 101, 101))
+    p.setColor(QPalette.ButtonText, QColor(231, 231, 231))
+    app.setPalette(p)
+
     app.setWindowIcon(QIcon(cfclient.module_path + "/icon-256.png"))
     # Make sure the right icon is set in Windows 7+ taskbar
     if os.name == 'nt':

This is a rather ugly patch, but maybe someone will find it useful while waiting for Qt 5.12.

@krichardsson
Copy link
Contributor

Great!

It seems as 5.12.0 will be released in a couple of weeks (https://wiki.qt.io/Qt_5.12_Release). Since it is released soonish I suggest that we do not implement the fix but wait for the new release instead.

If anyone is hit by this bug, please apply the above solution locally until Qt 5.12 is released.

@bgromov, thanks for a really good and clear error report!

@krichardsson
Copy link
Contributor

Hi @bgromov!
I have updated to latest OSX (10.14.2) and switched to the dark theme but my crazyflie client still has the same looks as before (light). What did you do to make it dark?

@bgromov
Copy link
Author

bgromov commented Jan 16, 2019

@krichardsson Although I updated Qt to 5.12 it actually did not solve the problem for me either, so for now I kept the changes to the palette (as in the patch above). I suspect it can be something related to Python Qt bindings that also have to be updated (i.e. PyQt / sip?)

@ataffanel
Copy link
Member

As far as I understand, the client un-modified display well but not in dark mode, and trying to emulate dark mode does not work due to a (py)Qt bug?

If so I would close this ticket since there is no problem with the current implementation, or rename it to "Add support for MacOS Mojave dark mode" or something similar to make it clear that this is about adding a functionality. What do you think?

@bgromov
Copy link
Author

bgromov commented Jan 29, 2019

I am not sure whose fault it is now. The Qt bug has been officially fixed and all the apps that link directly to Qt library have no problems in the dark mode anymore. It didn't work for the Crazyflie Client on my machine though, but I didn't bother to investigate further because rebuilding Sip and PyQt may destroy some of my other apps.

So, I can't really confirm there is no bug in the client. I would leave it open and maybe indeed rename it and/or mark it as an enhancement. For me the above palette patch is the only viable solution at the moment.

@krichardsson
Copy link
Contributor

We introduced themes in #431 and #432. The styling on OSX now bypasses the native UI and this should solve this problem as well.

@krichardsson krichardsson added this to the next-release milestone Aug 18, 2020
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

3 participants