diff --git a/io/ansiescapecodes.h b/io/ansiescapecodes.h index 8bad057..2b4aa18 100644 --- a/io/ansiescapecodes.h +++ b/io/ansiescapecodes.h @@ -2,6 +2,7 @@ #define IOUTILITIES_ANSIESCAPECODES #include "../global.h" +#include "../misc/traits.h" #include #include @@ -107,12 +108,18 @@ inline std::ostream &operator<<(std::ostream &stream, TextAttribute displayAttri return stream; } -inline auto color(Color foreground, Color background, TextAttribute displayAttribute = TextAttribute::Reset) +constexpr auto color(Color foreground, Color background, TextAttribute displayAttribute = TextAttribute::Reset) { return std::make_tuple(foreground, background, displayAttribute); } -inline std::ostream &operator<<(std::ostream &stream, std::tuple displayAttribute) +constexpr auto color(Color foreground, ColorContext context, TextAttribute displayAttribute = TextAttribute::Reset) +{ + return std::make_tuple(foreground, context, displayAttribute); +} + +template>, std::is_same>>...> +inline std::ostream &operator<<(std::ostream &stream, TupleType displayAttribute) { setStyle(stream, std::get<0>(displayAttribute), std::get<1>(displayAttribute), std::get<2>(displayAttribute)); return stream;