Browse Source

When drawing Tooltip, use tooltipTheme.textColor instead of menuTheme. Set tooltipTheme to fg color for all UI themes.

tags/v2.4.0
Andrew Belt 1 year ago
parent
commit
21e027ad80
2 changed files with 8 additions and 0 deletions
  1. +7
    -0
      src/ui/Tooltip.cpp
  2. +1
    -0
      src/ui/common.cpp

+ 7
- 0
src/ui/Tooltip.cpp View File

@@ -26,7 +26,14 @@ void Tooltip::step() {
void Tooltip::draw(const DrawArgs& args) { void Tooltip::draw(const DrawArgs& args) {
bndTooltipBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y); bndTooltipBackground(args.vg, 0.0, 0.0, box.size.x, box.size.y);
nvgTextLineHeight(args.vg, 1.2); nvgTextLineHeight(args.vg, 1.2);

// Because there is no bndThemeLabel() function, temporarily replace the menu text color with tooltip text color and draw a menu label
BNDtheme* theme = (BNDtheme*) bndGetTheme();
NVGcolor menuTextColor = theme->menuTheme.textColor;
theme->menuTheme.textColor = theme->tooltipTheme.textColor;
bndMenuLabel(args.vg, 0.0, 0.0, INFINITY, box.size.y, -1, text.c_str()); bndMenuLabel(args.vg, 0.0, 0.0, INFINITY, box.size.y, -1, text.c_str());
theme->menuTheme.textColor = menuTextColor;

Widget::draw(args); Widget::draw(args);
} }




+ 1
- 0
src/ui/common.cpp View File

@@ -67,6 +67,7 @@ void setTheme(NVGcolor bg, NVGcolor fg) {


// Tooltip background // Tooltip background
t.tooltipTheme.innerColor = bg; t.tooltipTheme.innerColor = bg;
t.tooltipTheme.textColor = fg;


bndSetTheme(t); bndSetTheme(t);
} }


Loading…
Cancel
Save