Merge pull request #41 from patrick96/master

Fixes jaagr/lemonbuddy#40
This commit is contained in:
Michael Carlberg 2016-08-31 21:16:19 +02:00
commit 365a9ccbda

View File

@ -389,22 +389,20 @@ void Builder::color_alpha(std::string alpha_)
{ {
auto alpha(alpha_); auto alpha(alpha_);
std::string val = this->get_opts()->foreground; std::string val = this->get_opts()->foreground;
if (alpha.find("#") == 0) { if (alpha.find("#") == std::string::npos ) {
if (alpha.size() == 3) alpha = "#" + alpha;
this->color(alpha.substr(0, 3) + val.substr(val.size() - 6)); }
else if (alpha.size() == 4)
this->color(alpha + alpha.substr(1)); if (alpha.size() == 4) {
this->color(alpha);
return; return;
} }
if (val.size() < 6 && val.size() > 2) { if (val.size() < 6 && val.size() > 2) {
val.append(val.substr(val.size() - 3)); val.append(val.substr(val.size() - 3));
} else if (val.length() > 6) {
val = "#" + val.substr(3);
} }
if (alpha.find("#") == std::string::npos) {
alpha = "#"+ alpha; this->color((alpha.substr(0, 3) + val.substr(val.size() - 6)).substr(0, 9));
}
this->color(alpha.substr(0, 3) + val.substr(val.size() - 6));
} }
void Builder::color_close(bool force) void Builder::color_close(bool force)