diff --git a/example/ex3/ex3.cpp b/example/ex3/ex3.cpp index cc77ca6e..69ad095d 100644 --- a/example/ex3/ex3.cpp +++ b/example/ex3/ex3.cpp @@ -32,8 +32,8 @@ main(int argc, char ** argv) { log_config::max_indent_width = 30; log_config::location_tab = 80; log_config::encoding = CE_Xterm; - log_config::function_entry_color = 69; - log_config::function_exit_color = 70; + log_config::function_entry_color = color_spec::xterm(69); + log_config::function_exit_color = color_spec::xterm(70); log_config::code_location_color = color_spec::xterm(166); int n = 3; diff --git a/include/indentlog/color.hpp b/include/indentlog/color.hpp index 7e600fa4..6d0ee749 100644 --- a/include/indentlog/color.hpp +++ b/include/indentlog/color.hpp @@ -143,31 +143,11 @@ namespace xo { Contents contents_; }; /*color_impl*/ - template - color_impl with_ansi_color(std::uint32_t color, Contents && contents) { - return color_impl(CF_All, color_spec::ansi(color), std::forward(contents)); - } /*with_ansi_color*/ - - template - color_impl with_xterm_color(std::uint32_t color, Contents && contents) { - return color_impl(CF_All, color_spec::xterm(color), std::forward(contents)); - } /*with_ansi_color*/ - template color_impl with_color(color_spec spec, Contents && contents) { return color_impl(CF_All, spec, std::forward(contents)); } /*with_color*/ - inline color_impl - color_on_ansi(std::uint32_t color) { - return color_impl(CF_ColorOn, color_spec::ansi(color), 0); - } /*color_on_ansi*/ - - inline color_impl - color_on_xterm(std::uint32_t color) { - return color_impl(CF_ColorOn, color_spec::xterm(color), 0); - } /*color_on_xterm*/ - inline color_impl color_on(color_spec spec) { return color_impl(CF_ColorOn, spec, 0); diff --git a/include/indentlog/log_config.hpp b/include/indentlog/log_config.hpp index d3e8c91d..b239aa60 100644 --- a/include/indentlog/log_config.hpp +++ b/include/indentlog/log_config.hpp @@ -34,8 +34,8 @@ namespace xo { /* color to use for function name, on entry/exit (xo::scope creation/destruction) * (ansi color codes, see Select Graphics Rendition subset) */ - static std::uint32_t function_entry_color; - static std::uint32_t function_exit_color; + static color_spec function_entry_color; + static color_spec function_exit_color; /* if true, append [file:line] to output */ static bool location_enabled; /* when .location_enabled, write [file:line] starting this many chars from left margin */ @@ -85,12 +85,12 @@ namespace xo { log_config_impl::encoding = CE_Ansi; template - std::uint32_t - log_config_impl::function_entry_color = 34; + color_spec + log_config_impl::function_entry_color = color_spec::ansi(34); template - std::uint32_t - log_config_impl::function_exit_color = 32; + color_spec + log_config_impl::function_exit_color = color_spec::ansi(32); template bool diff --git a/include/indentlog/log_state.hpp b/include/indentlog/log_state.hpp index 6895fb25..c1450779 100644 --- a/include/indentlog/log_state.hpp +++ b/include/indentlog/log_state.hpp @@ -194,9 +194,7 @@ namespace xo { this->indent(' '); char ee_label = '\0'; - std::uint32_t fn_color = 0; - - color_encoding encoding = log_config::encoding; + color_spec fn_color; /* mnemonic for scope entry/exit */ switch(entryexit) { @@ -232,7 +230,7 @@ namespace xo { this->ss_ << ' '; /* scope name - note no trailing newline; expect .preamble()/.postamble() caller to supply */ - this->ss_ << function_name(style, color_spec(encoding, fn_color), name1) << name2; + this->ss_ << function_name(style, fn_color, name1) << name2; } /*entryexit_aux*/ template