30 constexpr Rgba(
float red,
float green,
float blue,
float alpha)
31 : red(red), green(green), blue(blue), alpha(alpha) {
33 Rgba(
float red,
float green,
float blue,
Alpha alpha);
36 constexpr static Rgba u8(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha) {
37 return Rgba{
static_cast<float>(red) / 255.f,
static_cast<float>(green) / 255.f,
38 static_cast<float>(blue) / 255.f,
static_cast<float>(alpha) / 255.f };
74 explicit operator Rgb()
const;
87[[deprecated(
"Use mix instead")]]
97namespace jngl::internal {
99void invalid_rgba_color_literal_expected_format_hash_rrggbbaa();
103consteval jngl::Rgba operator""_rgba(
const char* hex,
size_t length) {
104 using jngl::internal::hexByte;
105 if (length == 9 && hex[0] ==
'#') {
106 return jngl::Rgba::u8(hexByte(hex + 1), hexByte(hex + 3), hexByte(hex + 5),
109 jngl::internal::invalid_rgba_color_literal_expected_format_hash_rrggbbaa();
Contains jngl::Rgb class.
Object representing only the Alpha Channel in an RGBA color, 0 meaning invisible, 1 fully visible.
Object representing a RGB color, new version of jngl::Color (which will be deprecated in the future)
Object representing a RGBA color.
void setRgb(Rgb color)
Overwrites red, green and blue, but leaves the alpha value untouched.
void setBlue(float)
0.0f ... 1.0f
constexpr float getGreen() const
0.0f ... 1.0fu
constexpr Rgba(float red, float green, float blue, float alpha)
constexpr float getRed() const
0.0f ... 1.0f
void setRed(float)
0.0f ... 1.0f
void setGreen(float)
0.0f ... 1.0f
constexpr float getBlue() const
0.0f ... 1.0f
constexpr float getAlpha() const
0.0f ... 1.0f
void setAlpha(float)
0.0f ... 1.0f
Color interpolate(Color a, Color b, float t)
Returns a color mix between a (t == 0) and b (t == 1)
Rgb mix(Rgb a, Rgb b, float t)
Returns a color mix between a (t == 0) and b (t == 1)