diff --git a/cufetch.1 b/cufetch.1 index e9a21b0..39f8aca 100644 --- a/cufetch.1 +++ b/cufetch.1 @@ -50,10 +50,10 @@ layout = [ * \fBb\fR for background color. * \fBo\fR for overline * \fBu\fR to underline the text * \fBa(value)\fR for fg alpha (either a percentage value like `50%` or a plain integer between 1 and 65536) * \fB!\fR for bold text * \fBL(value)\fR for choosing an underline style (`none`, `single`, `double`, `low`, `error`) - * \fBi\fR for italic text * \fBU(value)\fR for choosing the underline color (hexcode without #) - * \fBB(value)\fR for choosing the bg color text (hexcode without #) - \fBTerminal Only\fR * \fBS(value)\fR for choosing the strikethrough color (hexcode without #) - * \fBl\fR for blinking text * \fBO(value)\fR for choosing the overline color (hexcode without #) + * \fBi\fR for italic text * \fBU(value)\fR for choosing the underline color (hexcode color) + * \fBB(value)\fR for choosing the bg color text (hexcode color) + \fBTerminal Only\fR * \fBS(value)\fR for choosing the strikethrough color (hexcode color) + * \fBl\fR for blinking text * \fBO(value)\fR for choosing the overline color (hexcode color) * \fBA(value)\fR for choosing the bg text alpha (either a percentage value like `50%` or a plain integer between 1 and 65536) * \fBw(value)\fR for choosing the font weight (`ultralight`, `light`, `normal`, `bold`, `ultrabold`, `heavy`, or a numeric weight) .fi diff --git a/include/config.hpp b/include/config.hpp index 5c40c1d..02d0b5d 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -161,11 +161,11 @@ inline constexpr std::string_view AUTOCONFIG = R"#([config] # * b - for background color. * o - for overline # * u - to underline the text * a(value) - for fg alpha (either a plain integer between 1 and 65536 or a percentage value like `50%`) # * ! - for bold text * L(value) - to underline the text with a style (`none`, `single`, `double`, `low`, `error`) -# * i - for italic text * U(value) - for choosing the underline color (hexcode without #) -# * s - for strikethrough text * B(value) - for bg color text (same value as above) -# * S(value) - for strikethrough color (same value as above) -# Terminal Only * O(value) - for overline color (same value as above) -# * l - for blinking text * A(value) - for bg alpha (same value as a(value)) +# * i - for italic text * U(value) - for choosing the underline color (hexcode color) +# * s - for strikethrough text * B(value) - for bg color text (hexcode color) +# * S(value) - for strikethrough color (hexcode color) +# Terminal Only * O(value) - for overline color (hexcode color) +# * l - for blinking text * A(value) - for bg alpha (either a plain integer between 1 and 65536 or a percentage value like `50%`) # * w(value) - for specify font weight (`ultralight`, `light`, `normal`, `bold`, `ultrabold`, `heavy`, or a numeric weight) # # Alternatively, ANSI escape codes can be used, e.g ${\e[1;32m} or ${\e[38;2;34;255;11m}. diff --git a/src/parse.cpp b/src/parse.cpp index e1d6358..98c9c0a 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -367,7 +367,7 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a default: str_clr = color; break; } - const size_t pos = str_clr.find('#'); + const size_t pos = str_clr.rfind('#'); if (pos != std::string::npos) { std::string tagfmt = "span "; @@ -390,7 +390,7 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a }; bool bgcolor = false; - for (uint i = 0; i < opt_clr.length(); ++i) + for (size_t i = 0; i < opt_clr.length(); ++i) { switch (opt_clr.at(i)) { @@ -421,12 +421,12 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a case 'U': argmode_pos = i; - i += append_argmode("underline_color='#", "colored underline"); + i += append_argmode("underline_color='", "colored underline"); break; case 'B': argmode_pos = i; - i += append_argmode("bgcolor='#", "bgcolor"); + i += append_argmode("bgcolor='", "bgcolor"); break; case 'w': @@ -436,12 +436,12 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a case 'O': argmode_pos = i; - i += append_argmode("overline_color='#", "overline color"); + i += append_argmode("overline_color='", "overline color"); break; case 'S': argmode_pos = i; - i += append_argmode("strikethrough_color='#", "color of strikethrough line"); + i += append_argmode("strikethrough_color='", "color of strikethrough line"); break; } } @@ -498,7 +498,7 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a default: str_clr = color; break; } - const size_t pos = str_clr.find('#'); + const size_t pos = str_clr.rfind('#'); if (pos != std::string::npos) { const std::string& opt_clr = str_clr.substr(0, pos); @@ -518,7 +518,7 @@ std::optional parse_color_tag(Parser& parser, parse_args_t& parse_a }; bool bgcolor = false; - for (uint i = 0; i < opt_clr.length(); ++i) + for (size_t i = 0; i < opt_clr.length(); ++i) { switch (opt_clr.at(i)) {