workaround pybind11 vs fmt enum

This commit is contained in:
Klaim (Joël Lamotte) 2025-07-23 16:04:22 +02:00 committed by Joël Lamotte (Klaim)
parent 2259cee71e
commit 33356578e2
1 changed files with 28 additions and 28 deletions

View File

@ -57,36 +57,36 @@ namespace mambapy
{
namespace py = pybind11;
py::enum_<fmt::emphasis>(m, "TextEmphasis")
.value("Bold", fmt::emphasis::bold)
.value("Faint", fmt::emphasis::faint)
.value("Italic", fmt::emphasis::italic)
.value("Underline", fmt::emphasis::underline)
.value("Blink", fmt::emphasis::blink)
.value("Reverse", fmt::emphasis::reverse)
.value("Conceal", fmt::emphasis::conceal)
.value("Strikethrough", fmt::emphasis::strikethrough)
.def(py::init(&enum_from_str<fmt::emphasis>));
auto emphasis = py::enum_<fmt::emphasis>(m, "TextEmphasis")
.value("Bold", fmt::emphasis::bold)
.value("Faint", fmt::emphasis::faint)
.value("Italic", fmt::emphasis::italic)
.value("Underline", fmt::emphasis::underline)
.value("Blink", fmt::emphasis::blink)
.value("Reverse", fmt::emphasis::reverse)
.value("Conceal", fmt::emphasis::conceal)
.value("Strikethrough", fmt::emphasis::strikethrough);
emphasis.def(py::init(&enum_from_str<fmt::emphasis>));
py::implicitly_convertible<py::str, fmt::emphasis>();
py::enum_<fmt::terminal_color>(m, "TextTerminalColor")
.value("Black", fmt::terminal_color::black)
.value("Red", fmt::terminal_color::red)
.value("Green", fmt::terminal_color::green)
.value("Yellow", fmt::terminal_color::yellow)
.value("Blue", fmt::terminal_color::blue)
.value("Magenta", fmt::terminal_color::magenta)
.value("Cyan", fmt::terminal_color::cyan)
.value("White", fmt::terminal_color::white)
.value("BrightBlack", fmt::terminal_color::bright_black)
.value("BrightRed", fmt::terminal_color::bright_red)
.value("BrightGreen", fmt::terminal_color::bright_green)
.value("BrightYellow", fmt::terminal_color::bright_yellow)
.value("BrightBlue", fmt::terminal_color::bright_blue)
.value("BrightMagenta", fmt::terminal_color::bright_magenta)
.value("BrightCyan", fmt::terminal_color::bright_cyan)
.value("BrightWhite", fmt::terminal_color::bright_white)
.def(py::init(&enum_from_str<fmt::terminal_color>));
auto terminal_color = py::enum_<fmt::terminal_color>(m, "TextTerminalColor")
.value("Black", fmt::terminal_color::black)
.value("Red", fmt::terminal_color::red)
.value("Green", fmt::terminal_color::green)
.value("Yellow", fmt::terminal_color::yellow)
.value("Blue", fmt::terminal_color::blue)
.value("Magenta", fmt::terminal_color::magenta)
.value("Cyan", fmt::terminal_color::cyan)
.value("White", fmt::terminal_color::white)
.value("BrightBlack", fmt::terminal_color::bright_black)
.value("BrightRed", fmt::terminal_color::bright_red)
.value("BrightGreen", fmt::terminal_color::bright_green)
.value("BrightYellow", fmt::terminal_color::bright_yellow)
.value("BrightBlue", fmt::terminal_color::bright_blue)
.value("BrightMagenta", fmt::terminal_color::bright_magenta)
.value("BrightCyan", fmt::terminal_color::bright_cyan)
.value("BrightWhite", fmt::terminal_color::bright_white);
terminal_color.def(py::init(&enum_from_str<fmt::terminal_color>));
py::implicitly_convertible<py::str, fmt::terminal_color>();
py::class_<fmt::rgb>(m, "TextRGBColor")