indentlog: refactor: tag_config.tag_color uses color_spec

This commit is contained in:
Roland Conybeare 2023-09-18 13:09:15 -04:00
commit 6a06c769c8
2 changed files with 4 additions and 10 deletions

View file

@ -96,7 +96,7 @@ namespace xo {
if(PrefixSpace)
s << " ";
s << with_color(color_spec_type(tag_config::encoding, tag_config::tag_color), concat((char const *)":", tag.name()))
s << with_color(tag_config::tag_color, concat((char const *)":", tag.name()))
<< " " << unq(tag.value());
return s;

View file

@ -9,24 +9,18 @@ namespace xo {
/* Tag here b/c we want header-only library */
template <typename Tag>
struct tag_config_impl {
/* color encoding */
static color_encoding encoding;
/* color to use for tags
* os << tag("foo", foovalue)
* to produces output like
* :foo foovalue
* with :foo using .tag_color
*/
static std::uint32_t tag_color;
static color_spec_type tag_color;
}; /*tag_config_impl*/
template <typename Tag>
color_encoding
tag_config_impl<Tag>::encoding = color_encoding::xterm;
template <typename Tag>
std::uint32_t
tag_config_impl<Tag>::tag_color = 245;
color_spec_type
tag_config_impl<Tag>::tag_color = color_spec_type::xterm(245);
using tag_config = tag_config_impl<class tag_config_tag>;
} /*namespace xo*/