If bar bg, fg, border, or line color is alpha only, apply to default

This commit is contained in:
patrick96 2020-11-27 21:52:53 +01:00 committed by Patrick Ziegler
parent 53c6f3b042
commit 5007dae35a

View File

@ -199,7 +199,17 @@ bar::bar(connection& conn, signal_emitter& emitter, const config& config, const
const auto parse_or_throw_color = [&](string key, rgba def) -> rgba { const auto parse_or_throw_color = [&](string key, rgba def) -> rgba {
try { try {
return m_conf.get(bs, key, def); rgba color = m_conf.get(bs, key, def);
/*
* These are the base colors of the bar and cannot be alpha only
* In that case, we just use the alpha channel on the default value.
*/
if (color.type() == rgba::ALPHA_ONLY) {
return def.apply_alpha(color);
} else {
return color;
}
} catch (const exception& err) { } catch (const exception& err) {
throw application_error(sstream() << "Failed to set " << key << " (reason: " << err.what() << ")"); throw application_error(sstream() << "Failed to set " << key << " (reason: " << err.what() << ")");
} }