aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/Color.hpp
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-12-03 18:58:24 +0000
committerGitHub <[email protected]>2024-12-03 18:58:24 +0000
commit320144ae7288fe23686935ebb235d9fe0c900862 (patch)
tree351b04e228926f98c12c340284c25450bb1fed4f /src/helpers/Color.hpp
parent92186898c0ca1b3f72922b72c4af1723f0d9b888 (diff)
downloadHyprland-320144ae7288fe23686935ebb235d9fe0c900862.tar.gz
Hyprland-320144ae7288fe23686935ebb235d9fe0c900862.zip
core: move colorspace handling to oklab (#8635)
* Meson: add hyprgraphics * Nix: add hyprgraphics * CI/setup_base: get hyprgraphics-git --------- Co-authored-by: Mihai Fufezan <[email protected]>
Diffstat (limited to 'src/helpers/Color.hpp')
-rw-r--r--src/helpers/Color.hpp50
1 files changed, 31 insertions, 19 deletions
diff --git a/src/helpers/Color.hpp b/src/helpers/Color.hpp
index 32ed39ee..cf7f7943 100644
--- a/src/helpers/Color.hpp
+++ b/src/helpers/Color.hpp
@@ -1,35 +1,47 @@
#pragma once
#include <cstdint>
+#include <hyprgraphics/color/Color.hpp>
+#include "../debug/Log.hpp"
+#include "../macros.hpp"
-class CColor {
+class CHyprColor {
public:
- CColor();
- CColor(float r, float g, float b, float a);
- CColor(uint64_t);
-
- float r = 0, g = 0, b = 0, a = 1.f;
+ CHyprColor();
+ CHyprColor(float r, float g, float b, float a);
+ CHyprColor(const Hyprgraphics::CColor& col, float a);
+ CHyprColor(uint64_t);
// AR32
- uint32_t getAsHex() const;
-
- CColor operator-(const CColor& c2) const {
- return CColor(r - c2.r, g - c2.g, b - c2.b, a - c2.a);
+ uint32_t getAsHex() const;
+ Hyprgraphics::CColor::SSRGB asRGB() const;
+ Hyprgraphics::CColor::SOkLab asOkLab() const;
+ Hyprgraphics::CColor::SHSL asHSL() const;
+ CHyprColor stripA() const;
+
+ //
+ bool operator==(const CHyprColor& c2) const {
+ return c2.r == r && c2.g == g && c2.b == b && c2.a == a;
}
- CColor operator+(const CColor& c2) const {
- return CColor(r + c2.r, g + c2.g, b + c2.b, a + c2.a);
+ // stubs for the AnimationMgr
+ CHyprColor operator-(const CHyprColor& c2) const {
+ RASSERT(false, "CHyprColor: - is a STUB");
+ return {};
}
- CColor operator*(const float& v) const {
- return CColor(r * v, g * v, b * v, a * v);
+ CHyprColor operator+(const CHyprColor& c2) const {
+ RASSERT(false, "CHyprColor: + is a STUB");
+ return {};
}
- bool operator==(const CColor& c2) const {
- return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
+ CHyprColor operator*(const float& c2) const {
+ RASSERT(false, "CHyprColor: * is a STUB");
+ return {};
}
- CColor stripA() const {
- return {r, g, b, 1};
- }
+ double r = 0, g = 0, b = 0, a = 0;
+
+ private:
+ Hyprgraphics::CColor::SOkLab okLab; // cache for the OkLab representation
};