diff --git a/hyprbars/barDeco.cpp b/hyprbars/barDeco.cpp index 8df9b22..7ffb2e6 100644 --- a/hyprbars/barDeco.cpp +++ b/hyprbars/barDeco.cpp @@ -399,14 +399,14 @@ void CHyprBar::renderBarButtonsText(CBox* barBox, const float scale, const float // render icon const Vector2D BUFSIZE = {scaledButtonSize, scaledButtonSize}; - auto fgcolor = button.fgcol; + auto fgcol = button.fgcol; - if (fgcolor == CHyprColor(0, 0, 0, 0)) { + if (!button.userfg) { const bool LIGHT = button.bgcol.r + button.bgcol.g + button.bgcol.b < 1; - fgcolor = LIGHT ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000); + fgcol = LIGHT ? CHyprColor(0xFFFFFFFF) : CHyprColor(0xFF000000); } - renderText(button.iconTex, button.icon, fgcolor, BUFSIZE, scale, button.size * 0.62); + renderText(button.iconTex, button.icon, fgcol, BUFSIZE, scale, button.size * 0.62); } if (button.iconTex->m_iTexID == 0) diff --git a/hyprbars/globals.hpp b/hyprbars/globals.hpp index d42621d..c779a0e 100644 --- a/hyprbars/globals.hpp +++ b/hyprbars/globals.hpp @@ -7,6 +7,7 @@ inline HANDLE PHANDLE = nullptr; struct SHyprButton { std::string cmd = ""; + bool userfg = false; CHyprColor fgcol = CHyprColor(0, 0, 0, 0); CHyprColor bgcol = CHyprColor(0, 0, 0, 0); float size = 10; diff --git a/hyprbars/main.cpp b/hyprbars/main.cpp index 42fada2..48bab9d 100644 --- a/hyprbars/main.cpp +++ b/hyprbars/main.cpp @@ -75,14 +75,17 @@ Hyprlang::CParseResult onNewButton(const char* K, const char* V) { } auto bgcolor = configStringToInt(vars[1]); - auto fgcolor = configStringToInt(""); if (!bgcolor) { result.setError("invalid bgcolor"); return result; } + bool userfg = false; + auto fgcolor = configStringToInt(""); + if (vars.size() == 5) { + userfg = true; fgcolor = configStringToInt(vars[4]); if (!fgcolor) { result.setError("invalid fgcolor"); @@ -90,7 +93,7 @@ Hyprlang::CParseResult onNewButton(const char* K, const char* V) { } } - g_pGlobalState->buttons.push_back(SHyprButton{vars[3], *fgcolor, *bgcolor, size, vars[2]}); + g_pGlobalState->buttons.push_back(SHyprButton{vars[3], userfg, *fgcolor, *bgcolor, size, vars[2]}); for (auto& b : g_pGlobalState->bars) { b->m_bButtonsDirty = true;