diff --git a/src/main.cpp b/src/main.cpp index 1562890..74b62ff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,15 +43,18 @@ Color getColor(const char* param, unsigned char maxval) { if(strlen(color) == 4 || strlen(color) == 7) { char flag = 0; std::string hex(color); - unsigned int red = 0, green = 0, blue = 0; + unsigned int red = 0, green = 0, blue = 0, temp = 0; if (strlen(color) == 4) { // Try to parse the color as a shorthand 3-character color (e.g. '#FFF') if (sscanf(hex.substr(1,1).c_str(), "%X", &red) + sscanf(hex.substr(2,1).c_str(), "%X", &green) + sscanf(hex.substr(3,1).c_str(), "%X", &blue) == 3) { - red = red << 4; - green = green << 4; - blue = blue << 4; + temp = red; + red = red << 4 + temp; + temp = green; + green = green << 4 + temp; + temp = blue; + blue = blue << 4 + temp; flag++; } } else if (strlen(color) == 7) {