Skip to content

Commit

Permalink
chore: remove logging import
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 11, 2022
1 parent 92a90ad commit 292c653
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions shell/common/color_util.cc
Expand Up @@ -17,7 +17,7 @@

namespace {

bool IsHexFormat(const std::string& str) {
bool IsHexFormatWithAlpha(const std::string& str) {
// Must be either #ARGB or #AARRGGBB.
bool is_hex_length = str.length() == 5 || str.length() == 9;
if (str[0] != '#' || !is_hex_length)
Expand All @@ -37,10 +37,12 @@ SkColor ParseCSSColor(const std::string& color_string) {
// ParseCssColorString expects RGBA and we historically use ARGB
// so we need to convert before passing to ParseCssColorString.
std::string color_str;
if (IsHexFormat(color_string)) {
if (IsHexFormatWithAlpha(color_string)) {
std::string temp = color_string;
int len = color_string.length() == 5 ? 1 : 2;
color_str = temp.erase(1, len) + color_string.substr(1, len);
} else {
color_str = color_string;
}

SkColor color;
Expand Down

0 comments on commit 292c653

Please sign in to comment.