aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ViewStyle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r--src/ViewStyle.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 19a7b5275..b8fe0c0d6 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -617,6 +617,15 @@ ColourOptional ViewStyle::ElementColour(Element element) const {
return {};
}
+ColourRGBA ViewStyle::ElementColourForced(Element element) const {
+ // Like ElementColour but never returns empty - when not found return opaque black.
+ // This method avoids warnings for unwrapping potentially empty optionals from
+ // Visual C++ Code Analysis
+ const ColourOptional colour = ElementColour(element);
+ constexpr ColourRGBA opaqueBlack(0, 0, 0, 0xff);
+ return colour.value_or(opaqueBlack);
+}
+
bool ViewStyle::ElementAllowsTranslucent(Element element) const {
return elementAllowsTranslucent.count(element) > 0;
}