1
0
mirror of synced 2024-11-24 15:50:16 +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 { struct ACCENTPOLICY {
int na; u32 accentState;
int nf; u32 accentFlags;
int nc; u32 gradientColor;
int nA; u32 animationId;
}; };
struct WINCOMPATTRDATA { struct WINCOMPATTRDATA {
int na; int attribute;
PVOID pd; PVOID pData;
ULONG ul; ULONG dataSize;
}; };
EventManager::subscribe<EventThemeChanged>([this]{ EventManager::subscribe<EventThemeChanged>([this]{
auto hwnd = glfwGetWin32Window(this->m_window); 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) { if (user32Dll != nullptr) {
using SetWindowCompositionAttributeFunc = BOOL(WINAPI*)(HWND, WINCOMPATTRDATA*); using SetWindowCompositionAttributeFunc = BOOL(WINAPI*)(HWND, WINCOMPATTRDATA*);
@ -362,7 +362,7 @@ namespace hex {
GetProcAddress(user32Dll.get(), "SetWindowCompositionAttribute"); GetProcAddress(user32Dll.get(), "SetWindowCompositionAttribute");
if (SetWindowCompositionAttribute != nullptr) { 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) }; WINCOMPATTRDATA data = { 19, &policy, sizeof(ACCENTPOLICY) };
SetWindowCompositionAttribute(hwnd, &data); SetWindowCompositionAttribute(hwnd, &data);
} }

View File

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

View File

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

View File

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

View File

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