From 6e7d457a6fe82d0df6ba36596747336f1c0a45bc Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 8 Mar 2023 02:16:33 -0500 Subject: [PATCH] Initialize ui::Label::color with transparent black. If unchanged, text is drawn with the default theme color. --- src/ui/Label.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ui/Label.cpp b/src/ui/Label.cpp index db6cc055..4bb79140 100644 --- a/src/ui/Label.cpp +++ b/src/ui/Label.cpp @@ -9,7 +9,7 @@ Label::Label() { box.size.y = BND_WIDGET_HEIGHT; fontSize = BND_LABEL_FONT_SIZE; lineHeight = 1.2; - color = bndGetTheme()->regularTheme.textColor; + color = color::BLACK_TRANSPARENT; } void Label::draw(const DrawArgs& args) { @@ -30,7 +30,8 @@ void Label::draw(const DrawArgs& args) { } nvgTextLineHeight(args.vg, lineHeight); - bndIconLabelValue(args.vg, x, 0.0, box.size.x, box.size.y, -1, color, BND_LEFT, fontSize, text.c_str(), NULL); + NVGcolor colorActual = (color.a > 0.f) ? color : bndGetTheme()->regularTheme.textColor; + bndIconLabelValue(args.vg, x, 0.0, box.size.x, box.size.y, -1, colorActual, BND_LEFT, fontSize, text.c_str(), NULL); }