Add an UDL for combined hex RGB colors (#203)

In order to allow using the literal on its own it has been put into the
inline namespace `literals`.
This commit is contained in:
Henrik Gaßmann
2021-09-14 14:22:30 +02:00
committed by GitHub
parent b5c3b17b3f
commit 7d4452f45c
3 changed files with 27 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
#define FTXUI_SCREEN_COLOR
#include <stdint.h> // for uint8_t
#include <string> // for wstring
#include <string> // for wstring
#ifdef RGB
// Workaround for wingdi.h (via Windows.h) defining macros that break things.
@@ -322,6 +322,14 @@ class Color {
uint8_t blue_ = 0;
};
inline namespace literals {
/// @brief Creates a color from a combined hex RGB representation,
/// e.g. 0x808000_rgb
Color operator""_rgb(unsigned long long int combined);
} // namespace literals
} // namespace ftxui
#endif /* end of include guard: FTXUI_COLOR_H_ */