diff --git a/src/eepp/ui/uihtmlimage.cpp b/src/eepp/ui/uihtmlimage.cpp
index 75f407b64..75aa01edc 100644
--- a/src/eepp/ui/uihtmlimage.cpp
+++ b/src/eepp/ui/uihtmlimage.cpp
@@ -4,7 +4,9 @@
#include
#include
+#include
#include
+#include
#include
#include
@@ -49,7 +51,20 @@ void UIHTMLImage::draw() {
FontStyleConfig fontStyleConfig;
fontStyleConfig.Font = themeManager->getDefaultFont();
fontStyleConfig.CharacterSize = themeManager->getDefaultFontSize();
- fontStyleConfig.FontColor = Color( 128, 128, 128, mAlpha );
+
+ Color fontColor = Color::White;
+ Node* parent = mParentNode;
+ while ( parent ) {
+ if ( parent->isWidget() ) {
+ auto* w = parent->asType();
+ if ( w->isType( UI_TYPE_RICHTEXT ) ) {
+ fontColor = static_cast( w )->getFontColor();
+ break;
+ }
+ }
+ parent = parent->getParent();
+ }
+ fontStyleConfig.FontColor = Color( fontColor.r, fontColor.g, fontColor.b, mAlpha );
Float textWidth = Text::getTextWidth( mAlt, fontStyleConfig );
Float availableWidth = mSize.getWidth() - mPaddingPx.Left - mPaddingPx.Right;