diff --git a/.github/workflows/makefile.yml b/.github/workflows/makefile.yml index fd285fd..4771a26 100644 --- a/.github/workflows/makefile.yml +++ b/.github/workflows/makefile.yml @@ -167,4 +167,4 @@ jobs: # yes, i know too long # the --color arguments are just for adding a missing color to the non done ascii - name: Test all the ascii art logos - run: for f in assets/ascii/*; do printf "\e[31m%s\e[0m\n" $f && cufetch --wrap-lines=0 -s $f -D assets --color "c1=#fff111" --color "c2=#00ff1a" --color "c3=#faa311" --color "c4=#343412" --color "c5=#fff311" --color "c6=#faa3aa" && sleep 1; done + run: for f in assets/ascii/*; do printf "\e[31m%s\e[0m\n" "$f" && cufetch --wrap-lines=0 -s "$f" -D assets --color "c1=!#fff111" --color "c2=!#00ff1a" --color "c3=!#faa311" --color "c4=!#343412" --color "c5=!#fff311" --color "c6=!#faa3aa" && sleep 1; done diff --git a/src/parse.cpp b/src/parse.cpp index 0043ca6..fd9b5fa 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -263,12 +263,12 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a static std::vector auto_colors; - std::string output; - const Config& config = parse_args.config; - const colors_t& colors = parse_args.colors; - const size_t taglen = color.length() + "${}"_len; - const size_t tagpos = parse_args.pureOutput.find("${" + color + "}"); - const std::string& endspan = (!parse_args.firstrun_clr ? "" : ""); + std::string output; + const Config& config = parse_args.config; + const colors_t& colors = parse_args.colors; + const size_t taglen = color.length() + "${}"_len; + const size_t tagpos = parse_args.pureOutput.find("${" + color + "}"); + const std::string endspan = (!parse_args.firstrun_clr ? "" : ""); if (config.m_disable_colors) { @@ -520,12 +520,18 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a append_styles(style, fmt::fg(hexStringToColor(str_clr.substr(pos)))); // you can't fmt::format(style, ""); ughh - const uint32_t rgb_num = bgcolor ? style.get_background().value.rgb_color : style.get_foreground().value.rgb_color; - fmt::rgb rgb(rgb_num); - fmt::detail::ansi_color_escape ansi(rgb, bgcolor ? "\x1B[48;2;" : "\x1B[38;2;"); - fmt::detail::ansi_color_escape emph(style.get_emphasis()); - output += emph.begin(); - output += ansi.begin(); + if (style.has_background() || style.has_foreground()) + { + const uint32_t rgb_num = bgcolor ? style.get_background().value.rgb_color : style.get_foreground().value.rgb_color; + fmt::rgb rgb(rgb_num); + fmt::detail::ansi_color_escape ansi(rgb, bgcolor ? "\x1B[48;2;" : "\x1B[38;2;"); + output += ansi.begin(); + } + if (style.has_emphasis()) + { + fmt::detail::ansi_color_escape emph(style.get_emphasis()); + output += emph.begin(); + } } // "\\e" is for checking in the ascii_art, \033 in the config