hyperion.ng
ColorBgr.h
1 #pragma once
2 
3 // STL includes
4 #include <cstdint>
5 #include <iostream>
6 
7 struct ColorBgr;
8 
13 struct ColorBgr
14 {
16  uint8_t blue;
18  uint8_t green;
20  uint8_t red;
21 
23  static ColorBgr BLACK;
25  static ColorBgr RED;
27  static ColorBgr GREEN;
29  static ColorBgr BLUE;
31  static ColorBgr YELLOW;
33  static ColorBgr WHITE;
34 };
35 
37 static_assert(sizeof(ColorBgr) == 3, "Incorrect size of ColorBgr");
38 
46 inline std::ostream& operator<<(std::ostream& os, const ColorBgr& color)
47 {
48  os << "{" << unsigned(color.red) << "," << unsigned(color.green) << "," << unsigned(color.blue) << "}";
49  return os;
50 }
51 
52 
54 inline bool operator<(const ColorBgr & lhs, const ColorBgr & rhs)
55 {
56  return (lhs.red < rhs.red) && (lhs.green < rhs.green) && (lhs.blue < rhs.blue);
57 }
58 
60 inline bool operator<=(const ColorBgr & lhs, const ColorBgr & rhs)
61 {
62  return (lhs.red <= rhs.red) && (lhs.green <= rhs.green) && (lhs.blue <= rhs.blue);
63 }
static ColorBgr BLACK
&#39;Black&#39; RgbColor (0, 0, 0)
Definition: ColorBgr.h:23
static ColorBgr YELLOW
&#39;Yellow&#39; RgbColor (255, 255, 0)
Definition: ColorBgr.h:31
Plain-Old-Data structure containing the red-green-blue color specification.
Definition: ColorBgr.h:13
static ColorBgr BLUE
&#39;Blue&#39; RgbColor (0, 0, 255)
Definition: ColorBgr.h:29
static ColorBgr WHITE
&#39;White&#39; RgbColor (255, 255, 255)
Definition: ColorBgr.h:33
uint8_t blue
The blue color channel.
Definition: ColorBgr.h:16
uint8_t green
The green color channel.
Definition: ColorBgr.h:18
static ColorBgr RED
&#39;Red&#39; RgbColor (255, 0, 0)
Definition: ColorBgr.h:25
uint8_t red
The red color channel.
Definition: ColorBgr.h:20
static ColorBgr GREEN
&#39;Green&#39; RgbColor (0, 255, 0)
Definition: ColorBgr.h:27