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

Support runtime appearance adjustment on macOS #275

Merged
merged 12 commits into from
May 28, 2021

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Apr 9, 2021

On macOS switching appearance (Light -> Dark or Dark -> Light) when Bitcoin Core is running makes the GUI pretty unusable.
This bug is especially important when a user chose the "Auto" mode to adjust appearance automatically.

This PR fixes Bitcoin Core behavior.

This is an alternative to #268.

@hebasto
Copy link
Member Author

hebasto commented Apr 9, 2021

@goums @jarolrod

Do you mind testing this PR?

@RandyMcMillan
Copy link
Contributor

RandyMcMillan commented Apr 19, 2021

Concept ACK 3696ebc

Wow! Looks great!

MacOS 10.14.6 (18G8022) Light Theme

Screen Shot 2021-04-19 at 4 42 44 PM

MacOS 10.14.6 (18G8022) Dark Theme

Screen Shot 2021-04-19 at 4 42 56 PM

@RandyMcMillan
Copy link
Contributor

This window should probably be aware of the color scheme as well...

Screen Shot 2021-04-19 at 5 05 04 PM

@hebasto
Copy link
Member Author

hebasto commented Apr 19, 2021

This window should probably be aware of the color scheme as well...

Leaving it as is because have no nice design solution for now.

@RandyMcMillan
Copy link
Contributor

Concerning Accessibility: Using Accessibility Inspector on MacOS...

Screen Shot 2021-04-19 at 5 29 30 PM

When inverting colors - the warning doesn't have enough contrast. Maybe in a follow up this can be addressed.

Access1

Access2

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concept ACK

Spent all day playing around with this and have some findings. These are the main points summarized:

The State of macOS Dark Mode Support:

  • This PR does allow for runtime appearance adjustment
  • Dark mode does not work when compiled through depends natively on macOS 11 and 10.15. It does work on macOS 10.14 (out of scope of this PR)
  • The Linux cross-compiles work, this is important as the release binaries are cross-compiled from linux
    • There is a weird bug with rows in a table, they have their borders colored in white when in dark mode.
  • The macOS tool bump would break dark mode again (out of scope of this PR)

What this PR should fix:

  • Should fix the bug with tables when cross-compiled from linux

Below are pictures of this PR [natively compiled, native depends, cross-compile, cross-compile with macOS toolchain bump (19817)] on macOS [10.14, 10.15, 11]

macOS 10.14 Mojave

Native Compile

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 7 25 24 PM Screen Shot 2021-04-19 at 7 25 48 PM

Native Depends Build

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 7 28 38 PM Screen Shot 2021-04-19 at 7 27 59 PM

Linux Cross-Compile for macOS

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 9 41 15 PM Screen Shot 2021-04-19 at 9 41 34 PM

This PR + macOS Toolchain Bump

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 8 54 03 PM Screen Shot 2021-04-19 at 8 54 15 PM

macOS 10.15 Catalina

Native Compile

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-11 at 11 11 23 PM Screen Shot 2021-04-11 at 11 12 04 PM

Native Depends Build

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 8 31 07 PM Screen Shot 2021-04-19 at 8 31 19 PM

Linux Cross-Compile for macOS

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 9 58 48 PM Screen Shot 2021-04-19 at 9 59 12 PM

This PR + macOS Toolchain Bump

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 8 42 49 PM Screen Shot 2021-04-19 at 8 43 00 PM

macOS 11 Big Sur

Native Compile

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-12 at 1 37 45 AM Screen Shot 2021-04-12 at 1 38 04 AM

Native Depends Build

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 10 51 53 PM Screen Shot 2021-04-19 at 10 52 11 PM

Linux Cross-Compile for macOS

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 9 27 40 PM Screen Shot 2021-04-19 at 9 28 12 PM

This PR + macOS Toolchain Bump

Start: Dark Mode Switch: Light Mode
Screen Shot 2021-04-19 at 8 47 59 PM Screen Shot 2021-04-19 at 8 48 59 PM

@hebasto
Copy link
Member Author

hebasto commented Apr 20, 2021

@RandyMcMillan

Concerning Accessibility: Using Accessibility Inspector on MacOS...

Accessibility is out of this PR scope, as its only goal is the smooth runtime switching between dark and light appearances (note that the dark appearance is supported since #154).

I'll be happy to review dedicated prs that improves accessibility. Probably, it'd be nice to start from some kind of a design guide.

@hebasto
Copy link
Member Author

hebasto commented Apr 20, 2021

@jarolrod

Spent all day playing around with this and have some findings.

Many thanks for your extensive testing and reviewing!

  • Dark mode does not work when compiled through depends natively on macOS 11 and 10.15. It does work on macOS 10.14 (out of scope of this PR)

Sorry, still investigating this weird issue.

  • There is a weird bug with rows in a table, they have their borders colored in white when in dark mode.

Is this our bug or Qt's one (upstream)? Is this bug of the switching between modes? Or it was present in #154?

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quickly tested ACK 5737301. I've tested this rebased with bitcoin/bitcoin#21793.

hebasto added 12 commits May 1, 2021 15:07
This change is a prerequisite to support changeable appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
The ThemedLabel class correctly handles appearance changes on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
This change fixes the GUI when changing appearance on macOS.
@hebasto
Copy link
Member Author

hebasto commented May 1, 2021

Rebased 5737301 -> c231254 (pr275.01 -> pr275.02) on top of the merged bitcoin/bitcoin#21793 -- the dark mode works for every build :)

@hebasto hebasto added this to the 22.0 milestone May 8, 2021
@hebasto
Copy link
Member Author

hebasto commented May 27, 2021

@promag @jarolrod @Sjors

Do you mind having a (final) look at this PR after the recent rebasing?

@Sjors
Copy link
Member

Sjors commented May 27, 2021

This PR does not enable the dark mode for builds that have this feature unavailable now, i.e., native builds with depends.

Is this still true after the latest dependency bumps?

@hebasto
Copy link
Member Author

hebasto commented May 27, 2021

@Sjors

This PR does not enable the dark mode for builds that have this feature unavailable now, i.e., native builds with depends.

Is this still true after the latest dependency bumps?

Good catch! Removed.

@Sjors
Copy link
Member

Sjors commented May 27, 2021

tACK c231254 on macOS 11.4

The code changes look sane, but I didn't study them in detail.

This should also be tested on Linux and Windows, since not everything is wrapped in #ifdef Q_OS_MACOS.

I tested with and without depends. I'm able to toggle between dark and light mode in various screens and it looks healthy.

@goums
Copy link

goums commented May 27, 2021

ACK c231254

Tested on mac OS Big Sur (11.2.3)
Light/dark mode switching works very smoothly on every windows 👍
Compare to previous version, all icons and labels are re-colorized accordingly to the theme change

Screen capture for those who are not testing on macOS:

macos-light-dark-mode-switching.mov

Copy link
Member

@jarolrod jarolrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK c231254

Tested over all possible configurations (as i did here: #275 (review)). Also tested on Linux and Windows to ensure there are no introduced visual glitches. This looks good to merge.

@hebasto
Copy link
Member Author

hebasto commented May 28, 2021

This should also be tested on Linux and Windows, since not everything is wrapped in #ifdef Q_OS_MACOS.

On Linux Mint 20.1 (Qt 5.12.8) with installed qt5ct package I'm able to switch themes for Qt apps during their runtime.
This PR does not add support for such theme switching on Linux though. It ls left for follow ups.

@promag
Copy link
Contributor

promag commented May 28, 2021

Tested ACK c231254 on macOS Big Sur arm64.

@hebasto hebasto merged commit 123b401 into bitcoin-core:master May 28, 2021
@hebasto hebasto deleted the 210409-dark branch May 28, 2021 15:09
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 29, 2021
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin-core bitcoin-core locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants