aboutsummaryrefslogtreecommitdiff
path: root/src/util/color.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/color.cpp')
-rw-r--r--src/util/color.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/util/color.cpp b/src/util/color.cpp
new file mode 100644
index 0000000..17665de
--- /dev/null
+++ b/src/util/color.cpp
@@ -0,0 +1,15 @@
+#include "color.hpp"
+
+#include <fmt/color.h>
+
+std::string get_foreground_esc_seq(const uint32_t &color) noexcept
+{
+ return std::string(
+ fmt::detail::make_foreground_color<char>(fmt::detail::color_type(color)).begin());
+}
+
+std::string get_background_esc_seq(const uint32_t &color) noexcept
+{
+ return std::string(
+ fmt::detail::make_background_color<char>(fmt::detail::color_type(color)).begin());
+}