Project

General

Profile

Feature #6802 » 0006-Add-parseCssColor-support-for-alpha-constants.patch

Bruce Toll, 12/11/2018 11:08 PM

View differences:

src/web/ColorUtils.C
red = replicateHex(n.substr(1, 1));
green = replicateHex(n.substr(2,1));
blue = replicateHex(n.substr(3,1));
} else if (n.size() - 1 == 4) { // #rgba
red = replicateHex(n.substr(1, 1));
green = replicateHex(n.substr(2,1));
blue = replicateHex(n.substr(3,1));
alpha = replicateHex(n.substr(4,1));
} else if (n.size() - 1 == 6) { // #rrggbb
red = Utils::hexToInt(n.substr(1,2).c_str());
green = Utils::hexToInt(n.substr(3,2).c_str());
blue = Utils::hexToInt(n.substr(5,2).c_str());
} else if (n.size() - 1 == 8) { // #rrggbbaa
red = Utils::hexToInt(n.substr(1,2).c_str());
green = Utils::hexToInt(n.substr(3,2).c_str());
blue = Utils::hexToInt(n.substr(5,2).c_str());
alpha = Utils::hexToInt(n.substr(7,2).c_str());
} else {
LOG_ERROR("could not parse rgb format: " << n);
red = green = blue = -1;
(6-6/8)