From 5007dae35a49ef5f1553de347c23fc0153bcba13 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Fri, 27 Nov 2020 21:52:53 +0100
Subject: [PATCH] If bar bg, fg, border, or line color is alpha only, apply to
default
---
src/components/bar.cpp | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/components/bar.cpp b/src/components/bar.cpp
index ef29e766..94d2bf07 100644
--- a/src/components/bar.cpp
+++ b/src/components/bar.cpp
@@ -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 {
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) {
throw application_error(sstream() << "Failed to set " << key << " (reason: " << err.what() << ")");
}