NotepadNext icon indicating copy to clipboard operation
NotepadNext copied to clipboard

Dark mode

Open Jogai opened this issue 1 year ago • 9 comments

My system is using mostly QT apps and its configured with a dark theme that every qt app respects, even xnviewmp with system libs, which doesnt have a dark mode in windows i believe. However notepadNext doesnt. I dont know if its something that interests you, but I believe having a dark mode will give NotepadNext a popularity boost.

Jogai avatar Jul 09 '22 07:07 Jogai

Hi @Jogai, i think you should extend issue as "theme support". It shouldn't hard to implement dark mode support if you have some qt knowledge. For a simple solution you may invoke setStyleSheet method.

https://doc.qt.io/qt-6/stylesheet-examples.html

I would like to come with proof of concept pr but unfortunately my computer is broken. I believe you can implement a simple dark theme by trial and error before @dail8859 step up. Good luck.

FollowerOfBigboss avatar Jul 09 '22 18:07 FollowerOfBigboss

My understanding is that using the Flatpak will follow the system Qt theme. The AppImage will not.

That being said...having user defined themes (eg loading a css file) would be good to have eventually.

dail8859 avatar Jul 09 '22 20:07 dail8859

I didnt use flatpak or appimage, I took it from the aur, which is a source build: https://aur.archlinux.org/packages/notepadnext

Jogai avatar Jul 11 '22 05:07 Jogai

I have no clue how that works since it's not an official distribution mechanism for this project.

dail8859 avatar Jul 11 '22 11:07 dail8859

You can technically already launch the application with a custom CSS stylesheet by command line.

NotepadNext.exe -stylesheet style.css

You just need to create a style.css file in the same directory as the application. You can of course name the file something different or put it in a different location and specify the path on the command line.

It won't be perfect because the application uses its own stylesheet internally for tweaking some elements. But you can do some things quickly to test with, for example:

image

dail8859 avatar Jul 16 '22 00:07 dail8859

Well, that's an option, but I was thinking more along the lines of this: https://successfulsoftware.net/2021/03/31/how-to-add-a-dark-theme-to-your-qt-application/

Jogai avatar Jul 16 '22 09:07 Jogai

@Jogai

That points out a few ways to auto detect the OS preference but really just boils down to loading the appropriate CSS file.

The example I showed above was obviously very ugly and not suggesting using a red theme.

dail8859 avatar Jul 16 '22 12:07 dail8859

Yeah, but I tought that might be the problem. I styled my OS with kvantum and every app loads the same style. I thought maybe notepad next skips the os-wide stuff because its still white.

Jogai avatar Jul 18 '22 06:07 Jogai

I don't know anything about packages from aur but at least for flatpak distribution it is known to work with custom OS themes.

https://github.com/dail8859/NotepadNext/issues/109#issuecomment-1105907443

The application has its own internal stylesheet but it only tweaks things that are absolutely necessary. https://github.com/dail8859/NotepadNext/blob/master/src/NotepadNext/stylesheets/npp.css

dail8859 avatar Jul 18 '22 16:07 dail8859

This works now in the 0.5.4 version

Jogai avatar Sep 15 '22 15:09 Jogai

@Jogai Awesome! Glad to hear it is working now.

dail8859 avatar Sep 15 '22 15:09 dail8859

AppImage only change titlebar in dark mode (CutefishOS).

sonichy avatar Oct 13 '22 02:10 sonichy