From c063e56d6005f5b139590b8153819823af2c5de3 Mon Sep 17 00:00:00 2001 From: Toni500git Date: Tue, 16 Apr 2024 17:31:23 +0200 Subject: [PATCH] move $NO_COLOR check to main() --- include/fmt/color.h | 3 --- src/main.cpp | 8 ++++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index 6e521f9..bc6cb60 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -446,9 +446,6 @@ template void vformat_to( buffer& buf, const text_style& ts, basic_string_view format_str, basic_format_args>> args) { - char *no_color = getenv("NO_COLOR"); - if (no_color != NULL && no_color[0] != '\0') - disable_colors = true; if (disable_colors) { detail::vformat_to(buf, format_str, args, {}); diff --git a/src/main.cpp b/src/main.cpp index a2f9c3d..5f9737e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -403,7 +403,8 @@ int parseargs(int argc, char* argv[]) { // main int main(int argc, char* argv[]) { config = std::make_unique(); - + char *no_color = getenv("NO_COLOR"); + configfile = (getConfigDir() + "/config.toml"); themefile = (getConfigDir() + "/theme.toml"); @@ -414,7 +415,10 @@ int main(int argc, char* argv[]) { // i just want to feel good about having this check config->init(configfile, themefile); - fmt::disable_colors = config->colors == 0; + fmt::disable_colors = config->colors == false; + if (no_color != NULL && no_color[0] != '\0') + fmt::disable_colors = true; + if(op.test_colors) { test_colors();