diff --git a/AccentColorizer/AccentColorHelper.cpp b/AccentColorizer/AccentColorHelper.cpp index 83936e6..314caa4 100644 --- a/AccentColorizer/AccentColorHelper.cpp +++ b/AccentColorizer/AccentColorHelper.cpp @@ -1,8 +1,18 @@ #include "AccentColorHelper.h" #include "ColorHelper.h" +#include -COLORREF g_dwAccent; -int g_hsvAccentH; +COLORREF g_dwAccent{}; +hsl_t g_hslAccent{}; +hsl_t g_hslDefaultAccent{}; +double g_oldhslAccentS{}; +double g_balance1hslAccentS{}; +double g_balance2hslAccentS{}; +double g_oldhslAccentL{}; +int g_hslLightAccentH{}; +int g_hslDarkAccentH{}; +double g_hslEnhancedAccentL{}; +double g_oldhslEnhancedAccentL{}; bool UpdateAccentColor() { @@ -18,11 +28,108 @@ bool UpdateAccentColor() return false; } + if (accentColorChanges >= 2) { + g_oldhslAccentS = g_hslAccent.s; + if (g_oldhslAccentS <= 0.08) { + g_oldhslAccentS = 0.08; + } + } + else g_oldhslAccentS = 1; + + if (accentColorChanges >= 2) { + g_oldhslAccentL = g_hslAccent.l; + } + else g_oldhslAccentL = 0; + g_dwAccent = dwAccent; - g_hsvAccentH = rgb2hsv({ - (double) GetRValue(dwAccent) / 255, - (double) GetGValue(dwAccent) / 255, - (double) GetBValue(dwAccent) / 255 }).h; + + if ((double)GetRValue(dwAccent) == (double)GetGValue(dwAccent) && (double)GetGValue(dwAccent) == (double)GetBValue(dwAccent)) { + g_hslAccent.h = 210.0; + } + else { + g_hslAccent.h = rgb2hsl({ + (double)GetRValue(dwAccent) / 255, + (double)GetGValue(dwAccent) / 255, + (double)GetBValue(dwAccent) / 255 }).h; + } + if (g_hslAccent.h >= 0 && g_hslAccent.h < 125) { + g_hslLightAccentH = 60; + } + else if (g_hslAccent.h >= 125 && g_hslAccent.h < 150) { + g_hslLightAccentH = 120; + } + else if (g_hslAccent.h >= 150 && g_hslAccent.h < 240) { + g_hslLightAccentH = 180; + } + else if (g_hslAccent.h >= 240 && g_hslAccent.h < 345) { + g_hslLightAccentH = 300; + } + else if (g_hslAccent.h >= 345 && g_hslAccent.h < 360) { + g_hslLightAccentH = 420; + } + if (g_hslAccent.h >= 0 && g_hslAccent.h < 60) { + g_hslDarkAccentH = 0; + } + else if (g_hslAccent.h >= 60 && g_hslAccent.h < 180) { + g_hslDarkAccentH = 120; + } + else if (g_hslAccent.h >= 180 && g_hslAccent.h < 300) { + g_hslDarkAccentH = 240; + } + else if (g_hslAccent.h >= 300 && g_hslAccent.h < 360) { + g_hslDarkAccentH = 360; + } + + g_dwAccent = dwAccent; + if ((double)GetRValue(dwAccent) == (double)GetGValue(dwAccent) && (double)GetGValue(dwAccent) == (double)GetBValue(dwAccent)) { + if (accentColorChanges == 1) { + g_hslAccent.s = 0.5; + } + else g_hslAccent.s = 0.0801; + } + else { + g_hslAccent.s = pow(double(rgb2hsl({ + (double)GetRValue(dwAccent) / 254.999999999, + (double)GetGValue(dwAccent) / 254.999999999, + (double)GetBValue(dwAccent) / 254.999999999 }).s), double(0.95)); + } + + + g_balance1hslAccentS = g_hslAccent.s; + g_balance2hslAccentS = (1 - g_hslAccent.s); + + g_hslDefaultAccent.h = 206.532; + g_hslDefaultAccent.s = 1; + g_hslDefaultAccent.l = (double)(rgb2hsl({ + (double)0 / 255, + (double)120 / 255, + (double)215 / 255 }).l); + + if (g_hslAccent.s < 0.08) { + g_hslAccent.s = 0.08; + } + if (accentColorChanges >= 1) { + if (g_hslAccent.s > 1) { + g_hslAccent.s = g_balance1hslAccentS + g_balance2hslAccentS; + } + } + + if ((double)GetRValue(dwAccent) == (double)GetGValue(dwAccent) && (double)GetGValue(dwAccent) == (double)GetBValue(dwAccent)){ + if (accentColorChanges == 1) { + g_hslAccent.l = 0.0; + } + } + else { + g_hslAccent.l = ((double)(rgb2hsl({ + (double)GetRValue(dwAccent) / 255, + (double)GetGValue(dwAccent) / 255, + (double)GetBValue(dwAccent) / 255 }).l) - (double)(rgb2hsl({ + (double)0 / 255, + (double)110 / 255, + (double)199 / 255 }).l)) * -255.0; // based on default accent color #0078D7 (RGB 0, 120, 215), which is slightly darkened for DWM. + } + g_hslAccent.l = g_hslAccent.l; + g_oldhslEnhancedAccentL = (g_hslDefaultAccent.l * 255) - (g_oldhslAccentL); return true; -} +} \ No newline at end of file diff --git a/AccentColorizer/AccentColorHelper.h b/AccentColorizer/AccentColorHelper.h index f2987c1..5b5c45e 100644 --- a/AccentColorizer/AccentColorHelper.h +++ b/AccentColorizer/AccentColorHelper.h @@ -1,7 +1,18 @@ #pragma once #include "framework.h" +#include "ColorHelper.h" extern COLORREF g_dwAccent; -extern int g_hsvAccentH; +extern hsl_t g_hslAccent; +extern hsl_t g_hslDefaultAccent; +extern double g_oldhslAccentS; +extern double g_balance1hslAccentS; +extern double g_balance2hslAccentS; +extern double g_oldhslAccentL; +extern int g_hslLightAccentH; +extern int g_hslDarkAccentH; +extern double g_hslEnhancedAccentL; +extern double g_oldhslEnhancedAccentL; +extern int accentColorChanges; bool UpdateAccentColor(); diff --git a/AccentColorizer/AccentColorizer.vcxproj b/AccentColorizer/AccentColorizer.vcxproj index 13ff419..d1066af 100644 --- a/AccentColorizer/AccentColorizer.vcxproj +++ b/AccentColorizer/AccentColorizer.vcxproj @@ -38,40 +38,40 @@ Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application false - v142 + v143 true Unicode Application true - v142 + v143 Unicode Application false - v142 + v143 true Unicode Application false - v142 + v143 true Unicode @@ -101,25 +101,31 @@ true + $(ProjectName)-$(PlatformTarget) false + $(ProjectName)-$(PlatformTarget) false $(SolutionDir)Release\ Release\ + $(ProjectName)-$(PlatformTarget)-Static true + $(ProjectName)-$(PlatformTarget) false + $(ProjectName)-$(PlatformTarget) false $(SolutionDir)$(Platform)\Release\ $(Platform)\Release\ + $(ProjectName)-$(PlatformTarget)-Static @@ -165,7 +171,6 @@ true true true - $(OutDir)$(TargetName)-Static$(TargetExt) @@ -195,7 +200,6 @@ true true true - $(OutDir)$(TargetName)-x64$(TargetExt) @@ -213,7 +217,6 @@ true true true - $(OutDir)$(TargetName)-Static-x64$(TargetExt) @@ -222,6 +225,7 @@ + @@ -233,6 +237,7 @@ + diff --git a/AccentColorizer/AccentColorizer.vcxproj.filters b/AccentColorizer/AccentColorizer.vcxproj.filters index 31a5d9b..063894d 100644 --- a/AccentColorizer/AccentColorizer.vcxproj.filters +++ b/AccentColorizer/AccentColorizer.vcxproj.filters @@ -25,6 +25,9 @@ Source Files + + Header Files + @@ -54,6 +57,9 @@ Header Files + + Header Files + diff --git a/AccentColorizer/BitmapHelper.cpp b/AccentColorizer/BitmapHelper.cpp index 9201f8f..d39778c 100644 --- a/AccentColorizer/BitmapHelper.cpp +++ b/AccentColorizer/BitmapHelper.cpp @@ -40,7 +40,7 @@ bool IterateBitmap(HBITMAP hbm, BitmapPixelHandler handler) } SetBitmapBits(hbm, bm.bmWidth * bm.bmHeight * 4, pBits); - delete[] pBits; + return true; } \ No newline at end of file diff --git a/AccentColorizer/BitmapHelper.h b/AccentColorizer/BitmapHelper.h index 8c28111..7910907 100644 --- a/AccentColorizer/BitmapHelper.h +++ b/AccentColorizer/BitmapHelper.h @@ -1,5 +1,8 @@ #pragma once #include "framework.h" +#include + +extern std::set handledBitmaps; typedef void (*BitmapPixelHandler)(int& r, int& g, int& b, int& a); diff --git a/AccentColorizer/ColorHelper.cpp b/AccentColorizer/ColorHelper.cpp index 0df80e5..2da8277 100644 --- a/AccentColorizer/ColorHelper.cpp +++ b/AccentColorizer/ColorHelper.cpp @@ -6,12 +6,12 @@ DWORD rgb2bgr(COLORREF color) } -// https://stackoverflow.com/a/6930407 +// https://www.niwa.nu/2013/05/math-behind-colorspace-conversions-rgb-hsl/ -hsv_t rgb2hsv(rgb_t in) +hsl_t rgb2hsl(rgb_t in) { - hsv_t out; - double min, max, delta; + hsl_t out{}; + double min, max, sigma, delta; min = in.r < in.g ? in.r : in.g; min = min < in.b ? min : in.b; @@ -19,94 +19,137 @@ hsv_t rgb2hsv(rgb_t in) max = in.r > in.g ? in.r : in.g; max = max > in.b ? max : in.b; - out.v = max; // v + sigma = max + min; + out.l = sigma / 2; delta = max - min; - if (delta < 0.00001) - { - out.s = 0; - out.h = 0; // undefined, maybe nan? - return out; - } - if (max > 0.0) { // NOTE: if Max is == 0, this divide would cause a crash - out.s = (delta / max); // s + if (max > 0.0) { // NOTE: if max is == 0, this divide would cause a crash + if (out.l <= 0.5) + { + out.s = delta / sigma; + } + if (out.l > 0.5) + { + out.s = delta / (2 - sigma); + } + /* if (out.s > 1) + { + out.s = out.s - (out.s - 1); + } + if (out.s < 0) + { + out.s = (0 - out.s); + } */ } else { - // if max is 0, then r = g = b = 0 - // s = 0, h is undefined + // if max is 0, then r = g = b = 0 + out.h = 210.0; out.s = 0.0; - //out.h = NAN; // its now undefined return out; } - if (in.r >= max) // > is bogus, just keeps compilor happy - out.h = (in.g - in.b) / delta; // between yellow & magenta + if (in.r >= max) // ">" is useless, just keeps compiler happy + out.h = (((in.g - in.b) / 6) / delta) * 360.0; // between yellow & magenta else if (in.g >= max) - out.h = 2.0 + (in.b - in.r) / delta; // between cyan & yellow + out.h = ((1.0 / 3.0) + ((in.b - in.r) / 6) / delta) * 360.0; // between cyan & yellow else - out.h = 4.0 + (in.r - in.g) / delta; // between magenta & cyan - - out.h *= 60.0; // degrees + out.h = ((2.0 / 3.0) + ((in.r - in.g) / 6) / delta) * 360.0; // between magenta & cyan if (out.h < 0.0) out.h += 360.0; + if (out.h > 360.0) + out.h -= 360.0; + return out; } -rgb_t hsv2rgb(hsv_t in) +rgb_t hsl2rgb(hsl_t in) { - double hh, p, q, t, ff; - long i; - rgb_t out; + double ot{}, tt{}, ht{}, rt{}, gt{}, bt{}; // temporary values one, two, hue, red, green, blue + rgb_t out{}; - if (in.s <= 0.0) { // < is bogus, just shuts up warnings - out.r = in.v; - out.g = in.v; - out.b = in.v; + /*if (in.s <= 0.0) { // "<" is useless, just shuts up warnings + out.r = in.l; + out.g = in.l; + out.b = in.l; return out; + }*/ // this was making saturation always return 0 + if (in.l < 0.5) + { + ot = in.l * (1.0 + in.s); + } + else if (in.l >= 0.5) + { + ot = in.l + in.s - (in.l * in.s); + } + tt = (2 * in.l) - ot; + ht = in.h / 360.0; + if (ht > 0.6666667) { + rt = ht - (0.6666667); + } + if (ht <= 0.6666667) { + rt = ht + (0.3333333); + } + gt = ht; + if (ht < 0.3333333) { + bt = ht + (0.6666667); + } + if (ht >= 0.3333333) { + bt = ht - (0.3333333); + } + if (rt * 6 <= 1) { + out.r = tt + (ot - tt) * 6 * rt; + } + else if (rt * 2 <= 1) { + out.r = ot; + } + else if (rt * 3 <= 2) { + out.r = tt + (ot - tt) * (0.6666667 - rt) * 6; } - hh = in.h; - if (hh >= 360.0) hh = 0.0; - hh /= 60.0; - i = (long)hh; - ff = hh - i; - p = in.v * (1.0 - in.s); - q = in.v * (1.0 - (in.s * ff)); - t = in.v * (1.0 - (in.s * (1.0 - ff))); + else + out.r = tt; + if (gt * 6 <= 1) { + out.g = tt + (ot - tt) * 6 * gt; + } + else if (gt * 2 <= 1) { + out.g = ot; + } + else if (gt * 3 <= 2) { + out.g = tt + (ot - tt) * (0.6666667 - gt) * 6; + } + else + out.g = tt; + if (bt * 6 <= 1) { + out.b = tt + (ot - tt) * 6 * bt; + } + else if (bt * 2 <= 1) { + out.b = ot; + } + else if (bt * 3 <= 2) { + out.b = tt + (ot - tt) * (0.6666667 - bt) * 6; + } + else + out.b = tt; - switch (i) { - case 0: - out.r = in.v; - out.g = t; - out.b = p; - break; - case 1: - out.r = q; - out.g = in.v; - out.b = p; - break; - case 2: - out.r = p; - out.g = in.v; - out.b = t; - break; + if (out.r > 255) { + out.r = out.r - (out.r - 255); + } + if (out.g > 255) { + out.g = out.g - (out.g - 255); + } + if (out.b > 255) { + out.b = out.b - (out.b - 255); + } - case 3: - out.r = p; - out.g = q; - out.b = in.v; - break; - case 4: - out.r = t; - out.g = p; - out.b = in.v; - break; - case 5: - default: - out.r = in.v; - out.g = p; - out.b = q; - break; + if (out.r < 0) { + out.r = (0 - out.r); } + if (out.g < 0) { + out.g = (0 - out.g); + } + if (out.b < 0) { + out.b = (0 - out.b); + } + return out; } \ No newline at end of file diff --git a/AccentColorizer/ColorHelper.h b/AccentColorizer/ColorHelper.h index 2043b94..5b9efa4 100644 --- a/AccentColorizer/ColorHelper.h +++ b/AccentColorizer/ColorHelper.h @@ -5,13 +5,13 @@ DWORD rgb2bgr(COLORREF rgb); struct rgb_t { - double r, g, b; + double r{}, g{}, b{}; }; -struct hsv_t +struct hsl_t { - double h, s, v; + double h{}, s{}, l{}; }; -hsv_t rgb2hsv(rgb_t in); -rgb_t hsv2rgb(hsv_t in); \ No newline at end of file +hsl_t rgb2hsl(rgb_t in); +rgb_t hsl2rgb(hsl_t in); \ No newline at end of file diff --git a/AccentColorizer/SettingsHelper.cpp b/AccentColorizer/SettingsHelper.cpp index 1c68216..b97b73d 100644 --- a/AccentColorizer/SettingsHelper.cpp +++ b/AccentColorizer/SettingsHelper.cpp @@ -3,7 +3,17 @@ #include -bool IsRegistryValueEnabled(LPCWSTR key, LPCWSTR value) +#define DEFAULT_PROGRESS_BAR_COLORIZATION FALSE + +enum REGISTRY_OPTION_STATUS +{ + REGISTRY_OPTION_ENABLED, + REGISTRY_OPTION_DISABLED, + REGISTRY_OPTION_NOT_SET +}; + +REGISTRY_OPTION_STATUS +GetRegistryOptionStatus(LPCWSTR key, LPCWSTR value) { HKEY hKey; RegOpenKeyEx( @@ -13,7 +23,7 @@ bool IsRegistryValueEnabled(LPCWSTR key, LPCWSTR value) if (!hKey) { - return false; + return REGISTRY_OPTION_NOT_SET; } DWORD dwBufferSize(sizeof(DWORD)); @@ -26,7 +36,9 @@ bool IsRegistryValueEnabled(LPCWSTR key, LPCWSTR value) RegCloseKey(hKey); - return ERROR_SUCCESS == nError ? nResult : false; + return ERROR_SUCCESS == nError + ? REGISTRY_OPTION_ENABLED + : REGISTRY_OPTION_DISABLED; } bool IsMenuColorizationEnabled() @@ -42,5 +54,9 @@ bool IsMenuColorizationEnabled() bool IsProgressBarColorizationEnabled() { - return IsRegistryValueEnabled(L"SOFTWARE\\AccentColorizer", L"ColorizeProgressBar"); + REGISTRY_OPTION_STATUS status = GetRegistryOptionStatus(L"SOFTWARE\\AccentColorizer", L"ColorizeProgressBar"); + if (status == REGISTRY_OPTION_NOT_SET) { + return DEFAULT_PROGRESS_BAR_COLORIZATION; + } + return status == REGISTRY_OPTION_ENABLED; } \ No newline at end of file diff --git a/AccentColorizer/StyleColorHelper.cpp b/AccentColorizer/StyleColorHelper.cpp new file mode 100644 index 0000000..ecbe01a --- /dev/null +++ b/AccentColorizer/StyleColorHelper.cpp @@ -0,0 +1,9 @@ +/* #include "StyleColorHelper.h" + + +bool IterateColor(COLORREF color, ColorHandler handler) // dummy code +{ + int r, g, b; + GetTextColor; + return true; +} */ \ No newline at end of file diff --git a/AccentColorizer/StyleColorHelper.h b/AccentColorizer/StyleColorHelper.h new file mode 100644 index 0000000..811f82c --- /dev/null +++ b/AccentColorizer/StyleColorHelper.h @@ -0,0 +1,7 @@ +/* #pragma once +#include "framework.h" + +typedef void (*ColorHandler)(int& r, int& g, int& b); // dummy code + +bool IterateColor(COLORREF color, ColorHandler handler); // dummy code +*/ \ No newline at end of file diff --git a/AccentColorizer/StyleModifier.cpp b/AccentColorizer/StyleModifier.cpp index c1c059e..d036248 100644 --- a/AccentColorizer/StyleModifier.cpp +++ b/AccentColorizer/StyleModifier.cpp @@ -1,28 +1,77 @@ #include "StyleModifier.h" #include "BitmapHelper.h" +#include "StyleColorHelper.h" #include "ColorHelper.h" #include "AccentColorHelper.h" #include "SystemHelper.h" +#include bool g_bColorizeMenus; bool g_bColorizeProgressBar; +double g_hslEnhancedAccentHL{}; HTHEME hTheme = nullptr; +std::set handledBitmaps; + void StandardBitmapPixelHandler(int& r, int& g, int& b, int& a) { rgb_t rgbVal = { r, g, b }; - hsv_t hsvVal = rgb2hsv(rgbVal); + rgbVal.r = rgbVal.r / (a / 255.0); + rgbVal.g = rgbVal.g / (a / 255.0); + rgbVal.b = rgbVal.b / (a / 255.0); + hsl_t hslVal = rgb2hsl(rgbVal); + + g_hslEnhancedAccentHL = (g_hslDefaultAccent.l * 255.0) - g_hslAccent.l; + + hslVal.h = g_hslDefaultAccent.h; + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s / ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s; + + if (hslVal.l > (g_oldhslEnhancedAccentL)) { + if (g_oldhslAccentL < g_hslAccent.l && g_oldhslEnhancedAccentL > 107) { + hslVal.l = hslVal.l + ((g_hslAccent.l - g_oldhslAccentL + (0.000042 * (200 + g_oldhslAccentL) * ((hslVal.l - g_oldhslEnhancedAccentL) * g_oldhslAccentL))) * (pow(1 - ((hslVal.l - g_oldhslEnhancedAccentL) / 255.0), 2.0)) * hslVal.s); + } + else hslVal.l = hslVal.l + ((g_hslAccent.l - g_oldhslAccentL) * (pow(1 - ((hslVal.l - g_oldhslEnhancedAccentL) / 255.0), 2.0)) * hslVal.s); + } + else hslVal.l = hslVal.l - ((g_oldhslAccentL - g_hslAccent.l) * hslVal.s); - hsvVal.h = g_hsvAccentH; + if (hslVal.l > g_hslEnhancedAccentHL) { + hslVal.h = g_hslAccent.h + 0.5 * ((g_hslLightAccentH - g_hslAccent.h) * ((hslVal.l - g_hslEnhancedAccentHL) / (255.0 - g_hslEnhancedAccentHL))); + } + else if (hslVal.l <= g_hslEnhancedAccentHL) { + hslVal.h = g_hslAccent.h + 0.5 * ((g_hslDarkAccentH - g_hslAccent.h) * ((g_hslEnhancedAccentHL - hslVal.l) / g_hslEnhancedAccentHL)); + } + + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)g_hslAccent.s * ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)g_hslAccent.s; - rgbVal = hsv2rgb(hsvVal); + rgbVal = hsl2rgb(hslVal); + rgbVal.r = rgbVal.r * (a / 255.0); + rgbVal.g = rgbVal.g * (a / 255.0); + rgbVal.b = rgbVal.b * (a / 255.0); r = rgbVal.r; g = rgbVal.g; b = rgbVal.b; } +void StandardColorHandler(int& r, int& g, int& b) // dummy code +{ + rgb_t rgbVal = { 255, 128, 128 }; + hsl_t hslVal = rgb2hsl(rgbVal); + + hslVal.h = g_hslAccent.h; + hslVal.s = hslVal.s * (1 / g_oldhslAccentS) * g_hslAccent.s; + + rgbVal = hsl2rgb(hslVal); +} + + void SetCurrentTheme(LPCWSTR pszClassList) { if (hTheme) @@ -37,9 +86,21 @@ bool ModifyStyle(int iPartId, int iStateId, int iPropId) { HBITMAP hBitmap; GetThemeBitmap(hTheme, iPartId, iStateId, iPropId, GBF_DIRECT, &hBitmap); + if (handledBitmaps.find(hBitmap) != handledBitmaps.end()) + { + return true; + } + handledBitmaps.emplace(hBitmap); return IterateBitmap(hBitmap, StandardBitmapPixelHandler); } +/* bool ModifyColorStyle(int iPartId, int iStateId, int iPropId) // dummy code +{ + COLORREF hColor; + GetThemeColor(hTheme, iPartId, iStateId, iPropId, &hColor); + return IterateColor(hColor, StandardColorHandler); +} */ + /// /// At first glance, such refactoring looks useless, /// premature and counterproductive, but @@ -51,18 +112,32 @@ void ModifyStyles() int i, j, k; // + /* SetCurrentTheme(L"CommandModule"); // dummy code + // + ModifyColorStyle(3, 2, TMT_TEXTCOLOR); */ SetCurrentTheme(VSCLASS_BUTTON); // - ModifyStyle(BP_PUSHBUTTON, 0, TMT_DIBDATA); + ModifyStyle(BP_PUSHBUTTON, 0, 0); + ModifyStyle(BP_COMMANDLINK, 0, 0); for (j = 1; j <= 7; j++) { - ModifyStyle(BP_CHECKBOX, 0, j); ModifyStyle(BP_RADIOBUTTON, 0, j); + ModifyStyle(BP_CHECKBOX, 0, j); + ModifyStyle(BP_GROUPBOX, 0, j); + ModifyStyle(BP_COMMANDLINKGLYPH, 0, j); } - for (j = 1; j <= 3; j++) + + SetCurrentTheme(L"DarkMode_Explorer::Button"); + // + ModifyStyle(BP_PUSHBUTTON, 0, 0); + ModifyStyle(BP_COMMANDLINK, 0, 0); + for (j = 1; j <= 7; j++) { + ModifyStyle(BP_RADIOBUTTON, 0, j); + ModifyStyle(BP_CHECKBOX, 0, j); ModifyStyle(BP_GROUPBOX, 0, j); + ModifyStyle(BP_COMMANDLINKGLYPH, 0, j); } @@ -70,7 +145,20 @@ void ModifyStyles() // for (i = CP_DROPDOWNBUTTON; i <= CP_DROPDOWNBUTTONLEFT; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + } + } + + SetCurrentTheme(L"DarkMode_CFD::Combobox"); + // + for (i = CP_DROPDOWNBUTTON; i <= CP_DROPDOWNBUTTONLEFT; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + } } @@ -78,7 +166,20 @@ void ModifyStyles() // for (i = EP_EDITBORDER_NOSCROLL; i <= EP_EDITBORDER_HVSCROLL; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + } + } + + SetCurrentTheme(L"DarkMode_Explorer::Edit"); + // + for (i = EP_EDITBORDER_NOSCROLL; i <= EP_EDITBORDER_HVSCROLL; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + } } @@ -86,7 +187,10 @@ void ModifyStyles() // for (i = TABP_TABITEM; i <= TABP_TOPTABITEMBOTHEDGE; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + } } @@ -97,7 +201,6 @@ void ModifyStyles() for (j = 1; j <= 7; j++) { ModifyStyle(i, 0, j); - ModifyStyle(i, 0, j); } } @@ -106,7 +209,7 @@ void ModifyStyles() // for (i = LBCP_BORDER_HSCROLL; i <= LBCP_ITEM; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + ModifyStyle(i, 0, 0); } @@ -114,13 +217,16 @@ void ModifyStyles() // for (i = SPNP_UP; i <= SPNP_DOWNHORZ; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + ModifyStyle(i, 0, 0); } SetCurrentTheme(VSCLASS_HEADERSTYLE); // - ModifyStyle(HP_HEADERITEM, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(HP_HEADERITEM, 0, k); + } ///////////////////////////////////////////////////// @@ -128,7 +234,20 @@ void ModifyStyles() // for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } + } + + SetCurrentTheme(L"DarkMode::Toolbar"); + // + for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } @@ -136,7 +255,10 @@ void ModifyStyles() // for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } @@ -144,7 +266,10 @@ void ModifyStyles() // for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } @@ -152,7 +277,10 @@ void ModifyStyles() // for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } @@ -160,23 +288,63 @@ void ModifyStyles() // for (i = TP_BUTTON; i <= TP_SPLITBUTTONDROPDOWN; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } + } + + SetCurrentTheme(L"Placesbar::Toolbar"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); } - ///////////////////////////////////////////////////// + SetCurrentTheme(L"TrayNotify::Toolbar"); + // + ModifyStyle(TP_BUTTON, 1, 0); + + ///////////////////////////////////////////////////// SetCurrentTheme(L"BreadcrumbBar"); // - ModifyStyle(1, 0, TMT_DIBDATA); + ModifyStyle(1, 0, 0); + SetCurrentTheme(L"BrowserTab"); + // + for (j = 1; j <= 3; j++) + { + ModifyStyle(1, 0, j); + } + + SetCurrentTheme(L"BrowserTabBar"); + // + ModifyStyle(0, 0, 0); SetCurrentTheme(L"Explorer::TreeView"); // - for (i = 1; i <= 6; i++) + for (i = 1; i <= 4; i++) + { + for (j = 1; j <= 6; j++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } + } + } + + SetCurrentTheme(L"DarkMode_Explorer::TreeView"); + // + for (i = 1; i <= 4; i++) { - for (j = 1; j <= 2; j++) + for (j = 1; j <= 6; j++) { - ModifyStyle(i, j, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } } } @@ -187,42 +355,92 @@ void ModifyStyles() { for (j = 1; j <= 16; j++) { - ModifyStyle(i, j, TMT_DIBDATA); + ModifyStyle(i, j, 0); } } SetCurrentTheme(L"PreviewPane"); // - ModifyStyle(1, 1, TMT_DIBDATA); // Windows Vista/7 Explorer Bottom Details Panel + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); // Windows Vista/7 Explorer Bottom Details Panel + } + SetCurrentTheme(L"DarkMode::PreviewPane"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); // Windows Vista/7 Explorer Bottom Details Panel + } SetCurrentTheme(L"CommandModule"); // for (i = 1; i <= 11; i++) { if (i == 8) continue; - ModifyStyle(i, 0, TMT_DIBDATA); - ModifyStyle(i, 1, TMT_DIBDATA); + ModifyStyle(i, 0, 0); + ModifyStyle(i, 1, 0); + } + SetCurrentTheme(L"DarkMode::CommandModule"); + // + for (i = 1; i <= 11; i++) + { + if (i == 8) continue; + ModifyStyle(i, 0, 0); + ModifyStyle(i, 1, 0); } SetCurrentTheme(L"ItemsView"); // - for (i = 1; i <= 7; i++) + for (i = 2; i <= 6; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + ModifyStyle(3, 1, k); + ModifyStyle(3, 2, k); + } + } + for (j = 1; j <= 4; j++) { - ModifyStyle(3, i, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, j, k); + } } - + SetCurrentTheme(L"DarkMode::ItemsView"); + // + for (i = 2; i <= 6; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 0, k); + ModifyStyle(3, 1, k); + ModifyStyle(3, 2, k); + } + } + for (j = 1; j <= 4; j++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, j, k); + } + } + + SetCurrentTheme(L"ItemsView::Header"); // - ModifyStyle(1, 0, TMT_DIBDATA); // Explorer File Groups Header - for (i = 1; i <= 16; i++) + for (i = 1; i <= 7; i++) { - for (j = 1; j <= 16; j++) + for (j = 1; j <= 12; j++) { - ModifyStyle(i, j, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } } } @@ -234,7 +452,10 @@ void ModifyStyles() { for (j = 1; j <= 16; j++) { - ModifyStyle(i, j, TMT_DIBDATA); // Explorer File Selection + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); // Explorer File Selection + } } } for (i = 8; i <= 9; i++) @@ -248,9 +469,18 @@ void ModifyStyles() } } - - SetCurrentTheme(L"ListView"); + SetCurrentTheme(L"DarkMode_ItemsView::ListView"); // + for (i = 1; i <= 16; i++) + { + for (j = 1; j <= 16; j++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); // Explorer File Selection + } + } + } for (i = 8; i <= 9; i++) { for (j = 1; j <= 7; j++) @@ -263,13 +493,13 @@ void ModifyStyles() } - SetCurrentTheme(L"Explorer::ListView"); + SetCurrentTheme(L"ListView"); // - for (i = 8; i <= 9; i++) + for (i = 6; i <= 9; i++) { for (j = 1; j <= 7; j++) { - for (k = 1; k <= 7; k++) + for (k = 0; k <= 7; k++) { ModifyStyle(i, j, k); } @@ -277,15 +507,19 @@ void ModifyStyles() } - SetCurrentTheme(L"Explorer::TreeView"); + SetCurrentTheme(L"Explorer::ListView"); // - for (j = 1; j <= 7; j++) + for (i = 8; i <= 9; i++) { - for (k = 1; k <= 7; k++) + for (j = 1; j <= 7; j++) { - ModifyStyle(4, j, k); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } } } + ///////////////////////////////////////////////////// @@ -293,35 +527,67 @@ void ModifyStyles() // for (i = 1; i <= 4; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); // Explorer Breadcrumbs Highlight color + ModifyStyle(i, 0, 0); // Explorer Breadcrumbs Highlight color + } + + SetCurrentTheme(L"DarkMode_BBComposited::Toolbar"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); // Explorer Breadcrumbs Highlight color + } + + SetCurrentTheme(L"MaxInactiveBB::Toolbar"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); // Explorer Breadcrumbs Highlight color + } + + SetCurrentTheme(L"MaxInactiveBBComposited::Toolbar"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); // Explorer Breadcrumbs Highlight color + } + + SetCurrentTheme(L"ExplorerMenu::Toolbar"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); } ///////////////////////////////////////////////////// SetCurrentTheme(L"Go::Toolbar"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); SetCurrentTheme(L"InactiveGo::Toolbar"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); ///////////////////////////////////////////////////// SetCurrentTheme(L"MaxGo::Toolbar"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); + + SetCurrentTheme(L"MaxInactiveGo::Toolbar"); + // + ModifyStyle(1, 1, 0); ///////////////////////////////////////////////////// SetCurrentTheme(L"LVPopup::Toolbar"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); SetCurrentTheme(L"LVPopupBottom::Toolbar"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); ///////////////////////////////////////////////////// @@ -329,11 +595,11 @@ void ModifyStyles() ///////////////////////////////////////////////////// SetCurrentTheme(L"InactiveBB::Toolbar"); // - ModifyStyle(3, 1, TMT_DIBDATA); + ModifyStyle(3, 1, 0); for (j = 1; j <= 6; j++) { ModifyStyle(4, j, j); - ModifyStyle(4, j, TMT_DIBDATA); + ModifyStyle(4, j, 0); } @@ -342,20 +608,30 @@ void ModifyStyles() for (j = 1; j <= 6; j++) { ModifyStyle(4, j, j); - ModifyStyle(4, j, TMT_DIBDATA); + ModifyStyle(4, j, 0); } ///////////////////////////////////////////////////// SetCurrentTheme(L"DragDrop"); // - ModifyStyle(7, 0, TMT_DIBDATA); - ModifyStyle(8, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); + ModifyStyle(2, 0, k); + ModifyStyle(3, 0, k); + ModifyStyle(4, 0, k); + ModifyStyle(7, 0, k); + ModifyStyle(8, 0, k); + } + SetCurrentTheme(L"DropListControl"); + // + ModifyStyle(1, 0, 0); SetCurrentTheme(L"Header"); // - ModifyStyle(1, 0, TMT_DIBDATA); + ModifyStyle(1, 0, 0); SetCurrentTheme(L"PAUSE"); @@ -366,35 +642,30 @@ void ModifyStyles() } - SetCurrentTheme(L"Tab"); - // - for (i = 1; i <= 8; i++) - { - ModifyStyle(i, 1, TMT_DIBDATA); - } - - SetCurrentTheme(VSCLASS_MONTHCAL); // Explorer / Legacy Shell Date Picker // - for (i = 1; i <= 4; i++) + for (i = 10; i <= 11; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); - ModifyStyle(i, 1, TMT_DIBDATA); + ModifyStyle(i, 0, 0); + ModifyStyle(i, 1, 0); } for (j = 1; j <= 6; j++) { - ModifyStyle(MC_GRIDCELLBACKGROUND, j, TMT_DIBDATA); + ModifyStyle(MC_GRIDCELLBACKGROUND, j, 0); } SetCurrentTheme(L"DatePicker"); // - for (i = 1; i <= 2; i++) + for (i = 2; i <= 3; i++) { for (j = 0; j <= 1; j++) { ModifyStyle(i, j, 1); - ModifyStyle(i, j, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } } } @@ -402,31 +673,39 @@ void ModifyStyles() ///////////////////////////////////////////////////// SetCurrentTheme(L"Rebar"); // - ModifyStyle(6, 0, TMT_DIBDATA); + ModifyStyle(6, 0, 0); for (i = 4; i <= 6; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); - ModifyStyle(i, 1, TMT_DIBDATA); + ModifyStyle(i, 1, 0); + ModifyStyle(i, 1, 0); } + SetCurrentTheme(L"Default::Rebar"); + // + ModifyStyle(6, 0, 0); + + SetCurrentTheme(L"ExplorerBar::Rebar"); + // + ModifyStyle(6, 0, 0); + SetCurrentTheme(L"Navbar::Rebar"); // - ModifyStyle(6, 0, TMT_DIBDATA); - ModifyStyle(6, 1, TMT_DIBDATA); + ModifyStyle(6, 0, 0); + ModifyStyle(6, 1, 0); SetCurrentTheme(L"InactiveNavbar::Rebar"); // - ModifyStyle(6, 0, TMT_DIBDATA); - ModifyStyle(6, 1, TMT_DIBDATA); + ModifyStyle(6, 0, 0); + ModifyStyle(6, 1, 0); ///////////////////////////////////////////////////// SetCurrentTheme(L"Desktop::ListView"); // - for (j = 0; j <= 9; j++) + for (j = 0; j <= 6; j++) { - ModifyStyle(1, j, TMT_DIBDATA); // Desktop icons + ModifyStyle(1, j, 0); // Desktop icons } ///////////////////////////////////////////////////// @@ -443,6 +722,10 @@ void ModifyStyles() } } + SetCurrentTheme(L"ProperTree"); + // + ModifyStyle(1, 0, 0); + SetCurrentTheme(L"Navigation"); // @@ -456,6 +739,19 @@ void ModifyStyles() } } } + + SetCurrentTheme(L"DarkMode::Navigation"); + // + for (i = 0; i <= 10; i++) + { + for (j = 0; j <= 10; j++) + { + for (k = 0; k <= 10; k++) + { + ModifyStyle(i, j, k); + } + } + } ///////////////////////////////////////////////////// @@ -473,14 +769,31 @@ void ModifyStyles() SetCurrentTheme(L"SearchBox"); // - for (j = 1; j <= 7; j++) + for (i = 1; i <= 3; i++) { - for (k = 1; k <= 7; k++) + for (j = 1; j <= 7; j++) { - ModifyStyle(2, j, k); + ModifyStyle(i, j, k); + } + } + + SetCurrentTheme(L"DarkMode::SearchBox"); + // + for (i = 1; i <= 3; i++) + { + for (j = 1; j <= 7; j++) + { + ModifyStyle(i, j, k); } } + SetCurrentTheme(L"HelpSearchBox"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); + } + SetCurrentTheme(L"SearchBoxComposited::SearchBox"); // @@ -510,19 +823,45 @@ void ModifyStyles() // for (i = (g_winver >= WIN_10 ? 6 : 8); i <= (g_winver >= WIN_10 ? 9 : 11); i++) { - ModifyStyle(i, 0, TMT_DIBDATA); - ModifyStyle(i, 1, TMT_DIBDATA); + for (j = 1; j <= 4; j++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } + } } - if (g_bColorizeMenus) + SetCurrentTheme(L"TaskbandExtendedUILight::TaskbandExtendedUI"); // Light Mode Taskbar Thumbnail Media Controls + // + for (i = (g_winver >= WIN_10 ? 6 : 8); i <= (g_winver >= WIN_10 ? 9 : 11); i++) { + for (j = 1; j <= 4; j++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } + } + } + + if (g_bColorizeMenus) { SetCurrentTheme(L"Menu"); // - ModifyStyle(14, 0, TMT_DIBDATA); - ModifyStyle(13, 0, TMT_DIBDATA); - ModifyStyle(12, 0, TMT_DIBDATA); - ModifyStyle(8, 0, TMT_DIBDATA); - ModifyStyle(7, 0, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(16, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + ModifyStyle(13, 0, k); + ModifyStyle(12, 0, k); + ModifyStyle(10, 0, k); + ModifyStyle(9, 0, k); + ModifyStyle(8, 0, k); + ModifyStyle(7, 0, k); + } // Menu Checkbox for (j = 0; j <= 7; j++) @@ -532,48 +871,161 @@ void ModifyStyles() ModifyStyle(11, j, k); } } + + SetCurrentTheme(L"DarkMode::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(16, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + ModifyStyle(13, 0, k); + ModifyStyle(12, 0, k); + ModifyStyle(10, 0, k); + ModifyStyle(9, 0, k); + ModifyStyle(8, 0, k); + ModifyStyle(7, 0, k); + } + + // Menu Checkbox + for (j = 0; j <= 7; j++) + { + for (k = 0; k <= 7; k++) + { + ModifyStyle(11, j, k); + } + } + + SetCurrentTheme(L"ImmersiveStart::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + } + + SetCurrentTheme(L"ImmersiveStartDark::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + } + + SetCurrentTheme(L"DarkMode_ImmersiveStart::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + } + + SetCurrentTheme(L"LightMode_ImmersiveStart::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + } + + SetCurrentTheme(L"Communications::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + ModifyStyle(13, 0, k); + ModifyStyle(10, 0, k); + ModifyStyle(9, 0, k); + } + + SetCurrentTheme(L"Media::Menu"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(27, 0, k); + ModifyStyle(26, 0, k); + ModifyStyle(15, 0, k); + ModifyStyle(14, 0, k); + ModifyStyle(13, 0, k); + ModifyStyle(10, 0, k); + ModifyStyle(9, 0, k); + } } - if (g_bColorizeProgressBar) - { + if (g_bColorizeProgressBar) { SetCurrentTheme(L"Progress"); // - ModifyStyle(5, 4, TMT_DIBDATA); - for (i = 3; i <= 10; i++) + for (k = 1; k <= 7; k++) { - ModifyStyle(i, 1, TMT_DIBDATA); + ModifyStyle(5, 4, k); + ModifyStyle(6, 4, k); + } + for (i = 3; i <= 12; i++) + { + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } - SetCurrentTheme(L"Indeterminate::Progress"); // for (i = 3; i <= 10; i++) { - ModifyStyle(i, 1, TMT_DIBDATA); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 1, k); + } } + } + SetCurrentTheme(L"AB::AddressBand"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 4, k); + } - SetCurrentTheme(L"AB::AddressBand"); - // - ModifyStyle(1, 1, TMT_DIBDATA); + SetCurrentTheme(L"DarkMode_ABComposited::AddressBand"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, 4, k); } /** Tweaks for legacy components **/ SetCurrentTheme(L"Communications::Rebar"); // - ModifyStyle(6, 0, TMT_DIBDATA); + ModifyStyle(6, 0, 0); + + SetCurrentTheme(L"Media::Rebar"); + // + ModifyStyle(6, 0, 0); SetCurrentTheme(L"StartPanel"); // - ModifyStyle(1, 1, TMT_DIBDATA); + ModifyStyle(1, 1, 0); SetCurrentTheme(L"StartMenu::Toolbar"); // - ModifyStyle(10, 1, TMT_DIBDATA); - ModifyStyle(12, 1, TMT_DIBDATA); + ModifyStyle(10, 1, 0); + ModifyStyle(12, 1, 0); ///////////////////////////////////////////////////// @@ -581,7 +1033,7 @@ void ModifyStyles() // for (i = 1; i <= 38; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + ModifyStyle(i, 0, 0); } @@ -589,101 +1041,161 @@ void ModifyStyles() // for (i = 1; i <= 38; i++) { - ModifyStyle(i, 0, TMT_DIBDATA); + ModifyStyle(i, 0, 0); } ///////////////////////////////////////////////////// - if (g_winver < WIN_8) + SetCurrentTheme(L"TaskDialog"); + // + for (i = 1; i <= 8; i++) { - SetCurrentTheme(L"TaskDialog"); - // - for (i = 1; i <= 8; i++) + for (k = 1; k <= 7; k++) { - ModifyStyle(13, i, TMT_DIBDATA); + ModifyStyle(13, i, k); } + } - ///////////////////////////////////////////////////// - SetCurrentTheme(L"Header"); - // - for (i = 1; i <= 7; i++) + ///////////////////////////////////////////////////// + SetCurrentTheme(L"Header"); + // + for (i = 1; i <= 7; i++) + { + for (j = 1; j <= 12; j++) { - for (j = 1; j <= 12; j++) + for (k = 1; k <= 7; k++) { - for (k = 1; k <= 7; k++) - { - ModifyStyle(i, j, k); - } + ModifyStyle(i, j, k); } } + } + ///////////////////////////////////////////////////// - SetCurrentTheme(L"ItemsView::Header"); - // - for (i = 1; i <= 7; i++) - { - for (j = 1; j <= 12; j++) - { - for (k = 1; k <= 7; k++) - { - ModifyStyle(i, j, k); - } - } - } - ///////////////////////////////////////////////////// + SetCurrentTheme(L"ScrollBar"); + // + for (i = 1; i <= 10; i++) + { + ModifyStyle(i, 0, 0); + } - SetCurrentTheme(L"ScrollBar"); - // - for (i = 1; i <= 10; i++) - { - for (k = 1; k <= 4; k++) - { - ModifyStyle(i, 0, k); - } - } + SetCurrentTheme(L"DarkMode_Explorer::ScrollBar"); + // + for (i = 1; i <= 10; i++) + { + ModifyStyle(i, 0, 0); + } - // - // Aero Basic - // + // + // Aero Basic + // - SetCurrentTheme(L"TaskBar2::TaskBar"); - // - for (i = 1; i <= 8; i++) - { - ModifyStyle(i, 0, 0); - } + SetCurrentTheme(L"TaskBar2::TaskBar"); + // + for (i = 1; i <= 8; i++) + { + ModifyStyle(i, 0, 0); + } - SetCurrentTheme(L"AltTab"); - // - for (i = 1; i <= 11; i++) + SetCurrentTheme(L"AltTab"); + // + for (i = 1; i <= 11; i++) + { + for (k = 1; k <= 7; k++) { - ModifyStyle(i, 0, TMT_DIBDATA); + ModifyStyle(i, 0, k); } + } + SetCurrentTheme(L"Tooltip"); + // + for (i = 1; i <= 4; i++) + { + ModifyStyle(i, 0, 0); + } + ModifyStyle(6, 0, 0); - SetCurrentTheme(L"BasicMenuMode::TaskbandExtendedUI"); - // - ModifyStyle(1, 0, 0); + SetCurrentTheme(L"BasicMenuMode::TaskbandExtendedUI"); + // + ModifyStyle(1, 0, 0); - SetCurrentTheme(L"Window"); - // - for (i = 1; i <= 13; i++) + SetCurrentTheme(L"Flyout"); + // + ModifyStyle(5, 0, 0); + ModifyStyle(6, 0, 0); + + SetCurrentTheme(L"Window"); + // + for (i = 1; i <= 17; i++) + { + ModifyStyle(i, 0, 0); + } + for (i = 21; i <= 23; i++) + { + ModifyStyle(i, 0, 0); + } + + // + // Metro UI custom controls + SetCurrentTheme(L"DirectUI::Button"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); + ModifyStyle(2, 0, k); + ModifyStyle(3, 0, k); + ModifyStyle(6, 0, k); + } + + SetCurrentTheme(L"DirectUIDark::Button"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(2, 0, k); + ModifyStyle(3, 0, k); + ModifyStyle(6, 0, k); + } + + SetCurrentTheme(L"DirectUILight::Button"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(2, 0, k); + ModifyStyle(3, 0, k); + ModifyStyle(6, 0, k); + } + + SetCurrentTheme(L"PillTab::Tab"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); + } + + SetCurrentTheme(L"PillTabHighDPI::Tab"); + // + for (k = 1; k <= 7; k++) + { + ModifyStyle(1, 0, k); + } + + SetCurrentTheme(L"TouchSlider::TrackBar"); + // + for (i = 1; i <= 6; i++) + { + for (j = 1; j <= 5; j++) { - ModifyStyle(i, 0, 0); + for (k = 1; k <= 7; k++) + { + ModifyStyle(i, j, k); + } } - ModifyStyle(15, 4, 0); - ModifyStyle(17, 4, 0); - ModifyStyle(18, 4, 0); - ModifyStyle(19, 4, 0); - ModifyStyle(21, 4, 0); - ModifyStyle(23, 4, 0); } - // CloseThemeData(hTheme); hTheme = nullptr; } \ No newline at end of file diff --git a/AccentColorizer/SysColorsModifier.cpp b/AccentColorizer/SysColorsModifier.cpp index 580b99a..f29ce4a 100644 --- a/AccentColorizer/SysColorsModifier.cpp +++ b/AccentColorizer/SysColorsModifier.cpp @@ -1,23 +1,33 @@ #include "SysColorsModifier.h" #include "ColorHelper.h" #include "AccentColorHelper.h" +#include + +double g_hslEnhancedAccentHL2{}; constexpr int aSysElements[] = { COLOR_ACTIVECAPTION, COLOR_GRADIENTACTIVECAPTION, + COLOR_INACTIVECAPTION, + COLOR_GRADIENTINACTIVECAPTION, COLOR_HIGHLIGHT, COLOR_HOTLIGHT, COLOR_MENUHILIGHT }; constexpr size_t nSysElements = sizeof(aSysElements) / sizeof(*aSysElements); +constexpr int aSysElements2[] = { + COLOR_HIGHLIGHTTEXT, +}; +constexpr size_t nSysElements2 = sizeof(aSysElements2) / sizeof(*aSysElements2); + void ModifySysColors() { DWORD aNewColors[nSysElements]; COLORREF dwCurrentColor; - rgb_t rgbVal; - hsv_t hsvVal; + rgb_t rgbVal{}; + hsl_t hslVal{}; for (int i = 0; i < nSysElements; i++) { @@ -28,14 +38,104 @@ void ModifySysColors() (double)GetGValue(dwCurrentColor), (double)GetBValue(dwCurrentColor) }; - hsvVal = rgb2hsv(rgbVal); + hslVal = rgb2hsl(rgbVal); + + // While this is a straight up copy of the bitmap colorization, at least it works properly... old code is below. + + g_hslEnhancedAccentHL2 = (g_hslDefaultAccent.l * 255.0) - g_hslAccent.l; + + hslVal.h = g_hslDefaultAccent.h; + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s / ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s; - hsvVal.h = g_hsvAccentH; + if (hslVal.l > (g_oldhslEnhancedAccentL)) { + if (g_oldhslAccentL < g_hslAccent.l && g_oldhslEnhancedAccentL > 107) { + hslVal.l = hslVal.l + ((g_hslAccent.l - g_oldhslAccentL + (0.000042 * (200 + g_oldhslAccentL) * ((hslVal.l - g_oldhslEnhancedAccentL) * g_oldhslAccentL))) * (pow(1 - ((hslVal.l - g_oldhslEnhancedAccentL) / 255.0), 2.0)) * hslVal.s); + } + else hslVal.l = hslVal.l + ((g_hslAccent.l - g_oldhslAccentL) * (pow(1 - ((hslVal.l - g_oldhslEnhancedAccentL) / 255.0), 2.0)) * hslVal.s); + } + else hslVal.l = hslVal.l - ((g_oldhslAccentL - g_hslAccent.l) * hslVal.s); - rgbVal = hsv2rgb(hsvVal); + if (hslVal.l > g_hslEnhancedAccentHL2) { + hslVal.h = g_hslAccent.h + 0.5 * ((g_hslLightAccentH - g_hslAccent.h) * ((hslVal.l - g_hslEnhancedAccentHL2) / (255.0 - g_hslEnhancedAccentHL2))); + } + else if (hslVal.l <= g_hslEnhancedAccentHL2) { + hslVal.h = g_hslAccent.h + 0.5 * ((g_hslDarkAccentH - g_hslAccent.h) * ((g_hslEnhancedAccentHL2 - hslVal.l) / g_hslEnhancedAccentHL2)); + } + + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)g_hslAccent.s * ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)g_hslAccent.s; + + rgbVal = hsl2rgb(hslVal); aNewColors[i] = RGB(rgbVal.r, rgbVal.g, rgbVal.b); + } SetSysColors(nSysElements, aSysElements, aNewColors); + + // old code + + /*hslVal.h = g_hslDefaultAccent.h; + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s / ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_hslDefaultAccent.s; + + hslVal.l = hslVal.l - (g_oldhslAccentL - g_hslAccent.l - (3.6 * (g_hslDefaultAccent.l - (g_hslAccent.l / 255)))) * (1 - (hslVal.l / 255.0) ) * hslVal.s; + + hslVal.h = g_hslAccent.h; + + if (hslVal.l >= 128 && hslVal.l <= 254) { + hslVal.s = (double)hslVal.s * (double)g_hslAccent.s * ((1.0 - (hslVal.l / 255.0)) / (hslVal.l / 255.0)); + } + else hslVal.s = (double)hslVal.s * (double)g_hslAccent.s; + + rgbVal = hsl2rgb(hslVal);*/ + + + // code for changing highlighttext to black when highlight is too bright. doesn't work good enough. + + /*rgbVal = { + (double)GetRValue(COLOR_HIGHLIGHT), + (double)GetGValue(COLOR_HIGHLIGHT), + (double)GetBValue(COLOR_HIGHLIGHT) + }; + hslVal = rgb2hsl(rgbVal); + + hslVal.h = g_defaulthslAccentH; + hslVal.s = (double)hslVal.s * (double)(1 / (double)g_oldhslAccentS) * (double)g_defaulthslAccentS; + + hslVal.l = hslVal.l - (g_oldhslAccentL * hslVal.s) + (g_hslAccentL * hslVal.s); + + hslVal.h = g_hslAccentH; + hslVal.s = (double)hslVal.s * (double)g_hslAccentS; + + DWORD aNewColors2[nSysElements2]; + int i = 0; + if (hslVal.h >= 120 && hslVal.h <= 180) { + if (hslVal.l >= 120) { + aNewColors2[i] = RGB(0, 0, 0); + } + } + else if (hslVal.h >= 60 && hslVal.h < 120 || hslVal.h > 180 && hslVal.h <= 240) { + if (hslVal.l >= 145) { + aNewColors2[i] = RGB(0, 0, 0); + } + } + else if (hslVal.h >= 0 && hslVal.h < 60 || hslVal.h > 240 && hslVal.h <= 360) { + if (hslVal.l >= 170) { + aNewColors2[i] = RGB(0, 0, 0); + } + } + else if (hslVal.h >= 0 && hslVal.h <= 360) { + if (hslVal.l >= 0) { + aNewColors2[i] = RGB(255, 255, 255); + } + } + SetSysColors(nSysElements2, aSysElements2, aNewColors2); */ } \ No newline at end of file diff --git a/AccentColorizer/VersionInfo.rc b/AccentColorizer/VersionInfo.rc index b518cff..3531d23 100644 --- a/AccentColorizer/VersionInfo.rc +++ b/AccentColorizer/VersionInfo.rc @@ -12,12 +12,48 @@ ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// Russian (Russia) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) +LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Russian (Russia) resources +///////////////////////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////////////////////// // Neutral (Default) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT -#pragma code_page(1251) +#pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// // @@ -25,8 +61,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,2,0,0 - PRODUCTVERSION 1,2,0,0 + FILEVERSION 1,3,5,0 + PRODUCTVERSION 1,3,5,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -41,14 +77,14 @@ BEGIN BEGIN BLOCK "040004b0" BEGIN - VALUE "CompanyName", "krlvm" + VALUE "CompanyName", "krlvm, Rectify11 Team" VALUE "FileDescription", "AccentColorizer" - VALUE "FileVersion", "1.2.0.0" + VALUE "FileVersion", "1.3.5.0" VALUE "InternalName", "AccentColorizer.exe" - VALUE "LegalCopyright", "Copyright krlvm (C) 2021-2023" + VALUE "LegalCopyright", "Copyright krlvm, Rectify11 Team (C) 2021-2024" VALUE "OriginalFilename", "AccentColorizer.exe" VALUE "ProductName", "AccentColorizer" - VALUE "ProductVersion", "1.2.0.0" + VALUE "ProductVersion", "1.3.5.0" END END BLOCK "VarFileInfo" @@ -61,42 +97,6 @@ END ///////////////////////////////////////////////////////////////////////////// -///////////////////////////////////////////////////////////////////////////// -// Russian (Russia) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) -LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Russian (Russia) resources -///////////////////////////////////////////////////////////////////////////// - - #ifndef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// diff --git a/AccentColorizer/main.cpp b/AccentColorizer/main.cpp index 1528832..638d940 100644 --- a/AccentColorizer/main.cpp +++ b/AccentColorizer/main.cpp @@ -3,9 +3,11 @@ #include "StyleModifier.h" #include "SettingsHelper.h" #include "SystemHelper.h" +#include "BitmapHelper.h" constexpr LPCWSTR szWindowClass = L"ACCENTCOLORIZER"; HANDLE hMutex; +int accentColorChanges = 0; void ApplyAccentColorization() { @@ -18,18 +20,17 @@ void ApplyAccentColorization() // Apparently it is fixed in Windows 11 version 22H2 return; } - - ModifySysColors(); ModifyStyles(); + ModifySysColors(); + handledBitmaps.clear(); } LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { if (message == WM_DWMCOLORIZATIONCOLORCHANGED || - message == WM_DPICHANGED || - message == WM_THEMECHANGED || + message == WM_THEMECHANGED || message == WM_DPICHANGED || (message == WM_WTSSESSION_CHANGE && wParam == WTS_SESSION_UNLOCK) - ) + ) { if (message != WM_DWMCOLORIZATIONCOLORCHANGED) { @@ -40,15 +41,28 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) // d) Device was turned on after sleep, and colors and bitmaps probably were reset g_dwAccent = NULL; } + if (message == WM_THEMECHANGED) { + accentColorChanges = 0; // IMPORTANT: While this works better on modern 22H2, it doesn't on early 22H2 unless the program is compiled in debug mode. + // 23H2 is most likely working the same as modern 22H2, as they use the same base. Please test this on 24H2. + // Updated 22H2 issue: Brightness change is not applied correctly if the color applied has brightness different from the original #0078D7. + // (Fixed on November 20, 2024 by adding line 45 (setting a hue value before returning the HSL struct) to ColorHelper.cpp.) + // Early 22H2 issues: Colors are completely wrong (This could have been fixed after the November 20 code update.) + } + else if (message == WM_DWMCOLORIZATIONCOLORCHANGED || (message == WM_WTSSESSION_CHANGE && wParam == WTS_SESSION_UNLOCK) || message == WM_DPICHANGED) { + accentColorChanges = 2 + accentColorChanges; + } + else { + accentColorChanges = 0; + } ApplyAccentColorization(); } return DefWindowProc(hWnd, message, wParam, lParam); } int APIENTRY wWinMain(_In_ HINSTANCE hInstance, - _In_opt_ HINSTANCE hPrevInstance, - _In_ LPWSTR lpCmdLine, - _In_ int nCmdShow) + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPWSTR lpCmdLine, + _In_ int nCmdShow) { hMutex = CreateMutex(NULL, TRUE, szWindowClass); if (!hMutex || ERROR_ALREADY_EXISTS == GetLastError())