KTech 1.1.0
C++ 2D terminal game engine library
Loading...
Searching...
No Matches
rgb.hpp
1/*
2 KTech, Kaup's C++ 2D terminal game engine library.
3 Copyright (C) 2023-2025 Ethan Kaufman (AKA Kaup)
4
5 This file is part of KTech.
6
7 KTech is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 any later version.
11
12 KTech is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with KTech. If not, see <https://www.gnu.org/licenses/>.
19*/
20
21#pragma once
22
23#define KTECH_DEFINITION
24#include "../ktech.hpp"
25#undef KTECH_DEFINITION
26
29{
30 uint8_t r;
31 uint8_t g;
32 uint8_t b;
33
40 constexpr RGB(uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0)
41 : r(red), g(green), b(blue) {}
42
48 constexpr auto operator==(const RGB& rgb) const -> bool
49 {
50 return r == rgb.r && g == rgb.g && b == rgb.b;
51 }
52};
24-bit color, able of representing 16,777,216 (2^24) different colors.
Definition rgb.hpp:29
uint8_t g
Green primary color.
Definition rgb.hpp:31
constexpr auto operator==(const RGB &rgb) const -> bool
Compare 2 RGBs.
Definition rgb.hpp:48
constexpr RGB(uint8_t red=0, uint8_t green=0, uint8_t blue=0)
Construct an RGB color.
Definition rgb.hpp:40
uint8_t r
Red primary color.
Definition rgb.hpp:30
uint8_t b
Blue primary color.
Definition rgb.hpp:32