mu-utils: replace #define with constexpr for MU_COLOR_

This commit is contained in:
Dirk-Jan C. Binnema
2026-01-29 21:46:58 +02:00
committed by Seth Ladygo
parent 85f4a4b80a
commit db7bd7a900
2 changed files with 7 additions and 10 deletions

View File

@ -675,8 +675,6 @@ Mu::summarize(const std::string& str, size_t max_lines)
}
static bool
locale_is_utf8 (void)
{

View File

@ -665,14 +665,13 @@ private:
const bool color_;
};
#define MU_COLOR_RED "\x1b[31m"
#define MU_COLOR_GREEN "\x1b[32m"
#define MU_COLOR_YELLOW "\x1b[33m"
#define MU_COLOR_BLUE "\x1b[34m"
#define MU_COLOR_MAGENTA "\x1b[35m"
#define MU_COLOR_CYAN "\x1b[36m"
#define MU_COLOR_DEFAULT "\x1b[0m"
constexpr auto MU_COLOR_RED = "\x1b[31m";
constexpr auto MU_COLOR_GREEN = "\x1b[32m";
constexpr auto MU_COLOR_YELLOW = "\x1b[33m";
constexpr auto MU_COLOR_BLUE = "\x1b[34m";
constexpr auto MU_COLOR_MAGENTA = "\x1b[35m";
constexpr auto MU_COLOR_CYAN = "\x1b[36m";
constexpr auto MU_COLOR_DEFAULT = "\x1b[0m";
template<class Enum> // like C++23 std::to_underlying
constexpr std::underlying_type_t<Enum> to_ut( Enum e ) noexcept {