Additional tests of hex-conversions.
This commit is contained in:
12
main.cpp
12
main.cpp
@@ -5,6 +5,11 @@
|
||||
#include <Color4.hpp>
|
||||
#include <Colors.hpp>
|
||||
|
||||
std::string fmt_color(const Color4& c)
|
||||
{
|
||||
return std::format("{}hue:{} rgb: {},{},{} hex: {}", c.ToEscapeCode(), c.ToHSV().h, c.r, c.g, c.b, c.ToHex());
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef WIN32
|
||||
@@ -21,6 +26,11 @@ int main()
|
||||
mcolor::printAnsiColorTable();
|
||||
mcolor::printRGBConsoleTest();
|
||||
|
||||
std::cout << "Color construction from hex codes:" << std::endl;
|
||||
std::cout << fmt_color(Color4::FromHex("#FFFFFF")) << std::endl;
|
||||
std::cout << fmt_color(Color4::FromHex("#F0F0F0")) << std::endl;
|
||||
std::cout << fmt_color(Color4::FromHex("#0F0F0F")) << std::endl;
|
||||
std::cout << fmt_color(Color4::FromHex("#00AAFF")) << std::endl;
|
||||
|
||||
for (float i = 0; i < 360; i+=10.f)
|
||||
{
|
||||
@@ -28,7 +38,7 @@ int main()
|
||||
|
||||
Color4 c = Color4(hsva);
|
||||
|
||||
std::cout << std::format("{}hue:{} rgb: {},{},{}", toEscapeCode(c), i, c.r, c.g, c.b) << std::endl;
|
||||
std::cout << std::format("{}hue:{} rgb: {},{},{} hex: {}", c.ToEscapeCode(), i, c.r, c.g, c.b, c.ToHex()) << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user