normalize gradients and denormalize in groupbar

This commit is contained in:
Vaxry 2022-12-31 17:31:33 +01:00
parent 228e630f40
commit ddcae74e09
2 changed files with 5 additions and 5 deletions

View file

@ -2,8 +2,7 @@
#include "../defines.hpp"
#include <vector>
enum eConfigValueDataTypes
{
enum eConfigValueDataTypes {
CVD_TYPE_INVALID = -1,
CVD_TYPE_GRADIENT = 0
};
@ -18,7 +17,7 @@ interface ICustomConfigValueData {
class CGradientValueData : public ICustomConfigValueData {
public:
CGradientValueData(CColor col) {
m_vColors.push_back(col);
m_vColors.push_back(col * (1.f / 255.f));
};
virtual ~CGradientValueData(){};
@ -28,7 +27,7 @@ class CGradientValueData : public ICustomConfigValueData {
void reset(CColor col) {
m_vColors.clear();
m_vColors.emplace_back(col);
m_vColors.emplace_back(col * (1.f / 255.f));
m_fAngle = 0;
}

View file

@ -92,6 +92,7 @@ void CHyprGroupBarDecoration::draw(CMonitor* pMonitor, float a, const Vector2D&
CColor color = m_dwGroupMembers[i] == g_pCompositor->m_pLastWindow ? ((CGradientValueData*)PGROUPCOLACTIVE->get())->m_vColors[0] :
((CGradientValueData*)PGROUPCOLINACTIVE->get())->m_vColors[0];
color.a *= a;
color = color * 255.f; // gradient has 0 - 1
g_pHyprOpenGL->renderRect(&rect, color);
xoff += PAD + BARW;