1
- #include " stdafx.h" // ADDED BY PYTHONSCRIPT
2
1
#include " NppDarkMode.h"
2
+ #include " PluginInterface.h"
3
+
4
+ extern NppData nppData;
5
+
6
+ static constexpr COLORREF HEXRGB (DWORD rrggbb) {
7
+ // from 0xRRGGBB like natural #RRGGBB
8
+ // to the little-endian 0xBBGGRR
9
+ return
10
+ ((rrggbb & 0xFF0000 ) >> 16 ) |
11
+ ((rrggbb & 0x00FF00 )) |
12
+ ((rrggbb & 0x0000FF ) << 16 );
13
+ }
14
+
3
15
4
16
namespace NppDarkMode
5
17
{
6
18
bool isEnabled ()
7
19
{
8
- return false ;
20
+ return ::SendMessage (nppData._nppHandle , NPPM_ISDARKMODEENABLED, 0 , 0 );
21
+ }
22
+
23
+ HBRUSH getDarkerBackgroundBrush ()
24
+ {
25
+ return ::CreateSolidBrush (HEXRGB (0x202020 ));
26
+ }
27
+
28
+ COLORREF getTextColor ()
29
+ {
30
+ return HEXRGB (0xE0E0E0 );
9
31
}
10
32
11
- HBRUSH getDlgBackgroundBrush ()
33
+ COLORREF getDarkerTextColor ()
12
34
{
13
- return 0 ;
35
+ return HEXRGB (0xC0C0C0 );
36
+ }
37
+
38
+ COLORREF getLinkTextColor ()
39
+ {
40
+ return HEXRGB (0xFFFF00 );
41
+ }
42
+
43
+ COLORREF getDarkerBackgroundColor ()
44
+ {
45
+ return HEXRGB (0x202020 );
14
46
}
15
47
16
48
void setDarkTitleBar (HWND /* hwnd*/ )
@@ -19,6 +51,19 @@ namespace NppDarkMode
19
51
20
52
bool isWindows10 ()
21
53
{
22
- return true ;
54
+ return false ;
23
55
}
56
+
57
+ LRESULT onCtlColorDarker (HDC hdc)
58
+ {
59
+ if (!NppDarkMode::isEnabled ())
60
+ {
61
+ return FALSE ;
62
+ }
63
+
64
+ ::SetTextColor (hdc, NppDarkMode::getTextColor());
65
+ ::SetBkColor (hdc, NppDarkMode::getDarkerBackgroundColor());
66
+ return reinterpret_cast <LRESULT>(NppDarkMode::getDarkerBackgroundBrush ());
67
+ }
68
+
24
69
}
0 commit comments