1
0
mirror of synced 2024-11-12 10:10:53 +01:00

feat: Allow themes to set the background blur color

This commit is contained in:
WerWolv 2023-05-23 13:20:35 +02:00
parent cb9a3b1f55
commit 26eac61ddf
5 changed files with 14 additions and 10 deletions

View File

@ -338,21 +338,21 @@ namespace hex {
}
struct ACCENTPOLICY {
int na;
int nf;
int nc;
int nA;
u32 accentState;
u32 accentFlags;
u32 gradientColor;
u32 animationId;
};
struct WINCOMPATTRDATA {
int na;
PVOID pd;
ULONG ul;
int attribute;
PVOID pData;
ULONG dataSize;
};
EventManager::subscribe<EventThemeChanged>([this]{
auto hwnd = glfwGetWin32Window(this->m_window);
const auto user32Dll = WinUniquePtr<HMODULE>(LoadLibraryA("user32.dll"), FreeLibrary);
static auto user32Dll = WinUniquePtr<HMODULE>(LoadLibraryA("user32.dll"), FreeLibrary);
if (user32Dll != nullptr) {
using SetWindowCompositionAttributeFunc = BOOL(WINAPI*)(HWND, WINCOMPATTRDATA*);
@ -362,7 +362,7 @@ namespace hex {
GetProcAddress(user32Dll.get(), "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute != nullptr) {
ACCENTPOLICY policy = { ImGui::GetCustomStyle().WindowBlur > 0.5F ? 3 : 0, 0, 0, 0 };
ACCENTPOLICY policy = { ImGui::GetCustomStyle().WindowBlur > 0.5F ? 4U : 0U, 0, ImGui::GetCustomColorU32(ImGuiCustomCol_BlurBackground), 0 };
WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) };
SetWindowCompositionAttribute(hwnd, &data);
}

View File

@ -59,6 +59,7 @@
"window-background": "#000000FF"
},
"imhex": {
"blur-background": "#00000000",
"desc-button": "#282850FF",
"desc-button-active": "#505078FF",
"desc-button-hovered": "#3C3C64FF",

View File

@ -59,6 +59,7 @@
"window-background": "#0F0F0FFF"
},
"imhex": {
"blur-background": "#00000000",
"desc-button": "#141414FF",
"desc-button-active": "#3C3C3CFF",
"desc-button-hovered": "#282828FF",

View File

@ -59,6 +59,7 @@
"window-background": "#EFEFEFFF"
},
"imhex": {
"blur-background": "#00000000",
"desc-button": "#E6E6E6FF",
"desc-button-active": "#BEBEBEFF",
"desc-button-hovered": "#D2D2D2FF",

View File

@ -181,7 +181,8 @@ namespace hex::plugin::builtin {
{ "highlight", ImGuiCustomCol_Highlight },
{ "IEEE-tool-sign", ImGuiCustomCol_IEEEToolSign },
{ "IEEE-tool-exp", ImGuiCustomCol_IEEEToolExp },
{ "IEEE-tool-mantissa", ImGuiCustomCol_IEEEToolMantissa }
{ "IEEE-tool-mantissa", ImGuiCustomCol_IEEEToolMantissa },
{ "blur-background", ImGuiCustomCol_BlurBackground }
};