Skip to content

Commit

Permalink
help: Use color_t::from_hex_string() instead of from_argb_bytes()
Browse files Browse the repository at this point in the history
Colours obtained from help markup until now have been generated using
from_argb_bytes(), even though the caller ensures they are 7 characters
long and thus in #RRGGBB hex notation. When porting the help text render
code to pango_text, this resulted in text with colour set by markup
being rendered invisible with an alpha value of 0.

Unless we decide at a later point to support alpha values in help
markup, we want alpha to always be 255.
  • Loading branch information
irydacea committed Feb 17, 2021
1 parent 0ffe194 commit 041e56e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/help/help_impl.cpp
Expand Up @@ -1338,7 +1338,7 @@ color_t string_to_color(const std::string &cmp_str)
}
// a #rrggbb color in pango format.
if (*cmp_str.c_str() == '#' && cmp_str.size() == 7) {
return color_t::from_argb_bytes(strtoul(cmp_str.c_str() + 1, nullptr, 16));
return color_t::from_hex_string(cmp_str.substr(1));
}
return font::NORMAL_COLOR;
}
Expand Down

0 comments on commit 041e56e

Please sign in to comment.