GPR5100 - Rollback
Loading...
Searching...
No Matches
color.h
1#pragma once
2
3#include <SFML/Graphics/Color.hpp>
4#include <cstdint>
5
6namespace core
7{
11struct Color
12{
13 std::uint8_t r = 0u;
14 std::uint8_t g = 0u;
15 std::uint8_t b = 0u;
16 std::uint8_t a = 0u;
17 constexpr Color() = default;
18 constexpr Color(std::uint8_t red, std::uint8_t green, std::uint8_t blue, std::uint8_t alpha = 255u) :
19 r(red), g(green), b(blue), a(alpha) {}
20
21 operator sf::Color() const { return { r, g, b, a }; }
22
23 static constexpr Color red() { return { 255u,0u,0u,255u }; }
24 static constexpr Color green() { return { 0u,255u,0u,255u }; }
25 static constexpr Color blue() { return { 0u,0u,255u,255u }; }
26 static constexpr Color yellow() { return { 255u,255u,0u,255u }; }
27 static constexpr Color black() { return { 0u,0u,0u,255u }; }
28 static constexpr Color white() { return { 255u,255u,255u,255u }; }
29 static constexpr Color magenta() { return { 255u,0u,255u,255u }; }
30 static constexpr Color cyan() { return { 0u,255u,255u,255u }; }
31 static constexpr Color transparent() { return { 0u,0u,0u,0u }; }
32};
33
34} // namespace core
Color is a struct defining an RGBA color with 4 bytes.
Definition: color.h:12