Skip to content

Dark Mode for plugins #11546

@Leonard-The-Wise

Description

@Leonard-The-Wise

Hi,

Recently, I've added Dark Mode support for my Notepad++ Plugin - NWScript Tools (will be released in a couple days from now). Screenshot here:

image

The only problem: currently I have no way of detecting whether Notepad++ is using Dark Mode or not. I've implemented a "Crude" detector, based on fetching the window's pixels colors and setting dark mode according to the pixels luminosities when scintilla window finishes painting... sounds reasonable, but this method is glitchy, because not every time I can fetch the right pixels, specially when the user is actively resizing windowzes (if they do it abruptly the function will fail), also on minimize/maximize events and also on high DPI settings - specially if multimonitors are involved with different DPI for each.

Sample of the glitch:

image

So, a definitive solution is to modify Notepad++ to support a couple of new messages. One to allow plugins to query for Dark Mode status, other is a notification of when Notepad++ changes Dark Mode settings.

I already implemented the changes. This issue is to be associated with my pull request. :)

PS: I also took the freedom to fix a glitch with NppDarkMode.cpp that would cause any Checkbox styled with BS_PUSHLIKE to be drawn incorrectly. The bug is because any checkbox will be subclassed, and the BS_PUSHLIKE checkboxes don't need a subclass, just need a SetWindowTheme to work. Currently I don't know of any control in Notepad++ with this issue, but if you decide to add in the future it will be already issue-free with this pull request. Also, Tab controls subclasses work for TCS_BOTTOM style (tested on my plugin, see pictures above), so I removed the restriction from the function.

Thanks.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions