summaryrefslogtreecommitdiff
path: root/src/helpers/Color.cpp
diff options
context:
space:
mode:
authorVaxry <43317083+vaxerski@users.noreply.github.com>2024-12-07 18:51:18 +0100
committerGitHub <noreply@github.com>2024-12-07 18:51:18 +0100
commit8bbeee11734d3ba8e2cf15d19cb3c302f8bfdbf2 (patch)
tree5b6654818049a0743f62defc090e86d4327cccbb /src/helpers/Color.cpp
parentb1e5cc66bdb20b002c93479490c3a317552210b3 (diff)
core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us. It's not a strict requirement to be compliant, but I tuned it to be alright.
Diffstat (limited to 'src/helpers/Color.cpp')
-rw-r--r--src/helpers/Color.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/helpers/Color.cpp b/src/helpers/Color.cpp
index fe217c0f..7952ef55 100644
--- a/src/helpers/Color.cpp
+++ b/src/helpers/Color.cpp
@@ -5,32 +5,21 @@
#define GREEN(c) ((double)(((c) >> 8) & 0xff) / 255.0)
#define BLUE(c) ((double)(((c)) & 0xff) / 255.0)
-CHyprColor::CHyprColor() {}
-
-CHyprColor::CHyprColor(float r_, float g_, float b_, float a_) {
- r = r_;
- g = g_;
- b = b_;
- a = a_;
+CHyprColor::CHyprColor() = default;
+CHyprColor::CHyprColor(float r_, float g_, float b_, float a_) : r(r_), g(g_), b(b_), a(a_) {
okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
}
-CHyprColor::CHyprColor(uint64_t hex) {
- r = RED(hex);
- g = GREEN(hex);
- b = BLUE(hex);
- a = ALPHA(hex);
-
+CHyprColor::CHyprColor(uint64_t hex) : r(RED(hex)), g(GREEN(hex)), b(BLUE(hex)), a(ALPHA(hex)) {
okLab = Hyprgraphics::CColor(Hyprgraphics::CColor::SSRGB{r, g, b}).asOkLab();
}
-CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) {
+CHyprColor::CHyprColor(const Hyprgraphics::CColor& color, float a_) : a(a_) {
const auto SRGB = color.asRgb();
r = SRGB.r;
g = SRGB.g;
b = SRGB.b;
- a = a_;
okLab = color.asOkLab();
}