diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp index 3aa064b8af..39c76eb656 100644 --- a/src/slic3r/GUI/BitmapCache.cpp +++ b/src/slic3r/GUI/BitmapCache.cpp @@ -430,6 +430,14 @@ wxBitmap BitmapCache::mksolid(size_t width, size_t height, unsigned char r, unsi bool BitmapCache::parse_color(const std::string& scolor, unsigned char* rgb_out) { + if (scolor.size() == 9) { + unsigned char rgba[4]; + parse_color4(scolor, rgba); + rgb_out[0] = rgba[0]; + rgb_out[1] = rgba[1]; + rgb_out[2] = rgba[2]; + return true; + } rgb_out[0] = rgb_out[1] = rgb_out[2] = 0; if (scolor.size() != 7 || scolor.front() != '#') return false; diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index c0a9ff9c9f..621de739de 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -103,6 +103,16 @@ static std::array decode_color(const std::string& color) { ret[j] = float(digit1 * 16 + digit2) * INV_255; } } + else if (color.size() == 9 && color.front() == '#') { + for (size_t j = 0; j < 4; ++j) { + int digit1 = hex_digit_to_int(*c++); + int digit2 = hex_digit_to_int(*c++); + if (digit1 == -1 || digit2 == -1) + break; + + ret[j] = float(digit1 * 16 + digit2) * INV_255; + } + } return ret; }