Skip to content

[Feature request] Better dark mode support #4

Description

@alankilborn

Description of the Issue

Dark mode is ignored (i.e., lack of any specific code for handling it) in the 4.3 version of the demo plugin template. Thus when doing some fairly simple UI development in a plugin using the template, not all UI elements appear "dark".

Ideally, a plugin developer should not be impacted (too much) to provide a fully dark-mode enabled plugin, certainly not for a simple UI case like provided below.

Steps to Reproduce the Issue

  1. Obtain and build v. 4.3 of the plugin demo
  2. Install the plugin demo DLL under Notepad++ 8.5.2 (set with Dark Mode enabled; Windows itself in non-dark mode)
  3. Run Notepad++ and activate the "Dockable Dialog Demo" feature of the plugin; observe all controls are "dark":
    image
  4. Change the code to add a groupbox control and then re-parent the edit box control for line number input to be the groupbox via these steps:
  • add GROUPBOX "",IDC_GROUPBOX,0,0,180,180 to goLine.rc
  • add #define IDC_GROUPBOX (IDD_PLUGINGOLINE_DEMO + 6) to resource.h
  • add this case into GotoLineDlg.cpp (at the obvious spot):
        case WM_INITDIALOG:
        {
            HWND gbHwnd = ::GetDlgItem(_hSelf, IDC_GROUPBOX);
            RECT gbRect;
            ::GetWindowRect(gbHwnd, &gbRect);
            HWND childHwnd = ::GetDlgItem(_hSelf, ID_GOLINE_EDIT);
            RECT childRect;
            ::GetWindowRect(childHwnd, &childRect);
            int x = childRect.left - gbRect.left;
            int y = childRect.top - gbRect.top;
            int w = childRect.right - childRect.left;
            int h = childRect.bottom - childRect.top;
            ::SetParent(childHwnd, gbHwnd);
            ::MoveWindow(childHwnd, x, y, w, h, TRUE);
            return TRUE;
        }
  1. Build the new code and run it; observe the "Go To Line #" dockable panel's edit box control for line number input.

Expected Behavior

I expected the edit box for the line number input to be "dark".

Actual Behavior

The edit box for the line number input was "bright white":

image

Debug Information

plugin demo v.4.3

Running under:

Notepad++ v8.5.2 (64-bit)
Build time : Apr 4 2023 - 19:55:32
Path : W:\npp.misc_NoBackup\Releases\npp.8.5.2\npp.8.5.2.portable.x64\notepad++.exe
Command Line : -titleAdd="8.5.2 64-bit" -multiInst
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 10 Enterprise (64-bit)
OS Version : 21H2
OS Build : 19044.2728
Current ANSI codepage : 1252
Plugins :
ColumnsPlusPlus (0.2.0.6)
mimeTools (2.9)
NppConverter (4.5)
NppExport (0.4)
NppPluginDemo (4.3)
PythonScript (2)

Activity

  1. rdipardo commented on Apr 26, 2023

    @rdipardo

    Related (or maybe even overlapping?) . . .

    Those issues are about C# plugins, for which there is no native solution, as determined here, here and here.

    In fact, C# edit controls already go dark without any patching; with labels and buttons, the current behaviour is opposite to what happens with C++ plugins:

    system.windows.forms.textbox

    The other issues are at best complementary to the C++ plugin issue, meaning they touch on everything not related to the C++ plugins:

    set-complement

    In other words, they're completely unrelated.

  2. alankilborn commented on Apr 27, 2023

    @alankilborn
    Author

    Hmm, I think the addition of the Venn diagram in the above is basically saying to me: "You're stupid". If that was the intent, well, thanks for that. :-)

    Apparently there are "dark mode" complications for both C++ and C# plugin developers; if that's the commonality, then I'll stand by my comment making those complications "related".

  3. self-assigned this
    on May 21, 2023
  4. donho commented on Jan 28, 2024

    @donho
    Member

    @alankilborn
    It seems to me this issue has been fixed by notepad-plus-plus/notepad-plus-plus@e7f321f
    Could you try the API NPPM_DARKMODESUBCLASSANDTHEME ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions