Diff
1diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp
2index 7b39f8cb50a1d7d5fe4761519dcb1f80a07c872b..44425c263cf82f9ab3d2d73f8c13590f1d3062b6 100644
3--- a/src/TabGroup.cpp
4+++ b/src/TabGroup.cpp
5@@ -13,6 +13,24 @@
6 #include <pixman.h>
7
8 #include "globals.hpp"
9+#include "log.hpp"
10+
11+// This is a workaround CHyprColor not having working arithmetic operator...
12+static inline CHyprColor
13+merge_colors(float f1, CHyprColor c1, float f2, CHyprColor c2, float f3, CHyprColor c3) {
14+ Hyprgraphics::CColor::SOkLab oklab_out;
15+ float f[3] = {f1, f2, f3};
16+ Hyprgraphics::CColor::SOkLab c[3] = {c1.asOkLab(), c2.asOkLab(), c3.asOkLab()};
17+
18+ oklab_out.l = c[0].l * f[0] + c[1].l * f[1] + c[2].l * f[2];
19+ oklab_out.a = c[0].a * f[0] + c[1].a * f[1] + c[2].a * f[2];
20+ oklab_out.b = c[0].b * f[0] + c[1].b * f[1] + c[2].b * f[2];
21+ float alpha = c1.a * f[0] + c2.a * f[1] + c3.a * f[2];
22+
23+ // the alpha is linear, otherwise use the fact that CColor can take an OkLab and do the correct
24+ // conversion to an rgb
25+ return (CHyprColor(Hyprgraphics::CColor(oklab_out), alpha));
26+}
27
28 Hy3TabBarEntry::Hy3TabBarEntry(Hy3TabBar& tab_bar, Hy3Node& node): tab_bar(tab_bar), node(node) {
29 this->focused
30@@ -169,9 +187,15 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
31 // set brush
32 auto focused = this->focused.value();
33 auto urgent = this->urgent.value();
34- auto inactive = 1.0 - (focused + urgent);
35- auto c = (CHyprColor(*col_active) * focused) + (CHyprColor(*col_urgent) * urgent)
36- + (CHyprColor(*col_inactive) * inactive);
37+ auto inactive = 1.0f - (focused + urgent);
38+ CHyprColor c = merge_colors(
39+ focused,
40+ CHyprColor(*col_active),
41+ urgent,
42+ CHyprColor(*col_urgent),
43+ inactive,
44+ CHyprColor(*col_inactive)
45+ );
46
47 cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
48
49@@ -214,8 +238,17 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
50 pango_layout_set_width(layout, width * PANGO_SCALE);
51 pango_layout_set_ellipsize(layout, PANGO_ELLIPSIZE_END);
52
53- auto c = (CHyprColor(*col_text_active) * focused) + (CHyprColor(*col_text_urgent) * urgent)
54- + (CHyprColor(*col_text_inactive) * inactive);
55+ CHyprColor c = merge_colors(
56+ focused,
57+ CHyprColor(*col_text_active),
58+ urgent,
59+ CHyprColor(*col_text_urgent),
60+ inactive,
61+ CHyprColor(*col_text_inactive)
62+ );
63+
64+ // auto c = (CHyprColor(*col_text_active) * focused) + (CHyprColor(*col_text_urgent) * urgent)
65+ // + (CHyprColor(*col_text_inactive) * inactive);
66
67 cairo_set_source_rgba(cairo, c.r, c.g, c.b, c.a);
68