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

Option to use dark theme #68

Closed
ghost opened this issue Aug 21, 2020 · 19 comments
Closed

Option to use dark theme #68

ghost opened this issue Aug 21, 2020 · 19 comments
Labels

Comments

@ghost
Copy link

ghost commented Aug 21, 2020

@ghost ghost added the Feature label Aug 21, 2020
@jonatack
Copy link
Member

jonatack commented Aug 21, 2020

Concept ACK for a GUI option, if it makes dark mode easier for users to have.

I use the GUI with dark mode theme only, thanks to these tips from @laanwj: https://twitter.com/orionwl/status/1240948484334813185 and https://twitter.com/orionwl/status/1240954362614120448

@Bosch-0
Copy link

Bosch-0 commented Aug 23, 2020

What would be the technical hurdles of having a dark / light theme toggle switch in the settings / setup of the GUI?

@hebasto
Copy link
Member

hebasto commented Aug 23, 2020

@Bosch-0

What would be the technical hurdles of having a dark / light theme toggle switch in the settings / setup of the GUI?

release-notes-0.17.0.md:

The GUI suffers from visual glitches in the new MacOS dark mode.

@Bosch-0
Copy link

Bosch-0 commented Aug 23, 2020

Link did not work: https://bitcoincore.org/en/releases/0.17.0/

@Bosch-0
Copy link

Bosch-0 commented Aug 23, 2020

Looks like it is disabled in MacOS

bitcoin/bitcoin#14593

@hebasto
Copy link
Member

hebasto commented Aug 23, 2020

Link did not work: https://bitcoincore.org/en/releases/0.17.0/

Fixed.

Looks like it is disabled in MacOS

bitcoin/bitcoin#14593

Yes. This is a kind of workaround.

@goums
Copy link

goums commented Dec 11, 2020

I'm using Dark mode on self compiled GUI, thanks to the tips shared by @jonatack

I confirm, @hebasto comment:

The GUI suffers from visual glitches in the new MacOS dark mode.

I've found two main UI glitches:

  1. Icons stay in black on dark background:
    image

  2. Tabs focus and separator (in blue) are not clean:
    image

Otherwise, the dark mode seems pretty OK on macOS Big Sur.

I'll try to make PR to address the 2 issues above, if you think of any other glitches, let me know.

@prusnak
Copy link
Contributor

prusnak commented Dec 13, 2020

It seems that using https://github.com/ColinDuquesnoy/QDarkStyleSheet might resolve most of the visual issues.

Switching to dark mode in macOS, Qt will trigger an event of the type QEvent.PaletteChange which can be detected and actioned upon in the main widget's changeEvent method.

@goums
Copy link

goums commented Dec 17, 2020

@prusnak for now, the GUI is not using any self defined palette, it inherits the OS color palette.

We could force our own light / dark palette, but that will be a bigger change, and might involve some UI designers.

My idea was to keep the current system as it is, but just fix the 2/3 glitches that occur on mac OS dark mode.
It should be easier to integrate in the codebase.

@goums
Copy link

goums commented Dec 18, 2020

@prusnak I've tried to play with QPalette and styleSheet to fix the display glitches, but it's not working because the bugs are directly in QMacStyle definition.

One solution could be to use the embedded QT style fusion which requires no dependencies, and support Light / Dark mode out of the box.
See my comment with screenshots on this related issue: #136 (comment)

@ghost
Copy link
Author

ghost commented Jan 8, 2021

I was reading https://github.com/bitcoin-core/bitcoin-devwiki/wiki/0.21-Release-Candidate-Testing-Guide and it has dark mode screenshots

So do we already have dark theme in bitcoin core gui?

@goums
Copy link

goums commented Jan 8, 2021

@prayank23
currently, QT inherits from OS theme, so it depends on your OS, you can have dark mode on linux distributions.
on macos, it has been disabled because of the many glitches that were detected

I was reading https://github.com/bitcoin-core/bitcoin-devwiki/wiki/0.21-Release-Candidate-Testing-Guide and it has dark mode screenshots

I think this is linux platform screenshots

@ghost
Copy link
Author

ghost commented Mar 9, 2021

It seems that using https://github.com/ColinDuquesnoy/QDarkStyleSheet might resolve most of the visual issues.

@prusnak I tried following the steps mentioned in README.rst but getting error when I launch bitcoin-qt

Steps that I followed:

  1. Clone https://github.com/ColinDuquesnoy/QDarkStyleSheet.git
  2. Copy qdarkstyle/style.qss and qdarkstyle/style.qrc in src/qt
  3. Add path for style.qrc in contrib/bitcoin-qt.pro
RESOURCES += \
    ../src/qt/bitcoin.qrc
    ../src/qt/style.qrc
  1. Add below code in src/qt/bitcoingui.cpp:
#include <QTextStream>
QFile f(":/home/satoshi/bitcoin/src/qt/style.qss");

if (!f.exists())   {
    printf("Unable to set stylesheet, file not found\n");
}
else   {
    f.open(QFile::ReadOnly | QFile::Text);
    QTextStream ts(&f);
    qApp->setStyleSheet(ts.readAll());
}
  1. Launch bitcoin-qt

Error: Unable to set stylesheet, file not found

image

@jarolrod
Copy link
Member

@prayank23 on Ubuntu/Debian (as your screenshot suggests you are using), just set a dark GTK theme.

@ghost
Copy link
Author

ghost commented Mar 10, 2021

@jarolrod I understand the workaround as jonatack had shared links when I created this issue. I am trying to add option in Bitcoin Core to switch light/dark theme which can work on all platforms irrespective of OS settings.

@jarolrod
Copy link
Member

@prayank23 I see, you'd need to come up with a stylesheet for both (light + dark) I believe. Maybe in talks with the design community. And you can add a toggle button somewhere in the menu.

@ghost
Copy link
Author

ghost commented Mar 26, 2021

Its working :) Suggestion by @hebasto in IRC channel ##bitcoin-core-gui helped. Had to remove : from QFile f(":/home/satoshi/bitcoin/src/qt/style.qss");

There are few things that will need to be changed or added. Screenshots:

image

image

image

image

image

image

Splash screen still looks the same:

image

@ghost
Copy link
Author

ghost commented Mar 27, 2021

This does not work on Windows as expected

maflcko pushed a commit that referenced this issue Mar 29, 2021
dc4551c remove incompatibility release note for darkmode on macos (Sylvain Goumy)
303cfc6 allow darkmode on macos build (Sylvain Goumy)
78f75a2 Allow icon colorization on mac os to better support dark mode (Uplab)

Pull request description:

  Allow icons to be colorized on macOS to support native Dark mode color scheme.

  Rendering on macOS Big Sur before PR:
  ![macos-darkmode-before-pr](https://user-images.githubusercontent.com/5577626/102502739-43f3af80-407f-11eb-9263-5bbc27b371c2.png)

  Rendering on macOS Big Sur after PR:
  ![macos-darkmode-after-pr](https://user-images.githubusercontent.com/5577626/102502678-350cfd00-407f-11eb-8b98-e271f2688c36.png)

  Light mode stay visually unchanged.

  <del>Note, that this currently only affect the build from source, as the macos dmg includes an attributes to force light color scheme on macos windows (see bitcoin/bitcoin#14593). </del>
  <del>But once all glitches are fixed, we will be able to remove this temporary fix. </del>
  Edit: this PR is know including the removal of `NSRequiresAquaSystemAppearance` on Info.plist file so that the color fix is apply to every build.

  Linked issues: #68 #136

ACKs for top commit:
  hebasto:
    re-ACK dc4551c
  jarolrod:
    ACK dc4551c

Tree-SHA512: 1c3a4dec796063e61fcaf80112afc2b15c8669a1cd30ebd537cea96647c20215f8f80289719f905820bb0c490c8c1f94bfae4bb32f9c6d1fdd4e8f199ebb559f
@hebasto
Copy link
Member

hebasto commented Jul 4, 2021

After #366 is merged the Bitcoin Core GUI should follow system appearance settings. It works on macOS. Also it works on some DEs on Linux. Not sure if anybody test the current master on Windows, though.

Going to close this issue. Feel free to open a new platform or DE specific one.

@hebasto hebasto closed this as completed Jul 4, 2021
@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

No branches or pull requests

6 participants