- scene::ISceneNode *parent_node;
- std::string nametag_text;
- video::SColor nametag_color;
- v3f nametag_pos;
+
+ video::SColor getBgColor(bool use_fallback) const
+ {
+ if (bgcolor)
+ return bgcolor.value();
+ else if (!use_fallback)
+ return video::SColor(0, 0, 0, 0);
+ else if (textcolor.getLuminance() > 186)
+ // Dark background for light text
+ return video::SColor(50, 50, 50, 50);
+ else
+ // Light background for dark text
+ return video::SColor(50, 255, 255, 255);
+ }