2023-09-13 20:42:01 +02:00

53 lines
1.2 KiB
C++

#pragma once
namespace kek {
struct Color {
float r, g, b, a;
constexpr Color(float r, float g, float b, float a)
: r(r),
g(g),
b(b),
a(a) {}
constexpr Color(float r, float g, float b)
: Color(r, g, b, 1.0) {}
constexpr Color()
: Color(0, 0, 0, 1) {}
float *valuePointer() {
return &r;
}
constexpr Color darker(float factor = 0.7) const {
return Color(r * factor, g * factor, b * factor, a);
}
constexpr Color brighter(float factor = 0.7) const {
return Color(r / factor, g / factor, b / factor, a);
}
};
class Colors {
public:
static constexpr Color RED = Color(1.0, 0.0, 0.0);
static constexpr Color ORANGE = Color(1.0, 0.5, 0.0);
static constexpr Color YELLOW = Color(1.0, 1.0, 0.0);
static constexpr Color GREEN = Color(0.0, 1.0, 0.0);
static constexpr Color CYAN = Color(0.0, 1.0, 1.0);
static constexpr Color BLUE = Color(0.0, 0.0, 1.0);
static constexpr Color PURPLE = Color(0.5, 0.0, 0.5);
static constexpr Color MAGENTA = Color(1.0, 0.0, 1.0);
static constexpr Color GRAY = Color(0.5, 0.5, 0.5);
static constexpr Color WHITE = Color(1.0, 1.0, 1.0);
static constexpr Color BLACK = Color(0.0, 0.0, 0.0);
static constexpr Color TRANSPARENT = Color(0.0, 0.0, 0.0, 0.0);
Colors() = delete;
};
}