[LyX/master] Fix IM color mixing

Koji Yokota <[email protected]> Thu, 11 Jun 2026 10:57:25 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit 66e8e2c014d5f359f60279123319b696b6a51c92
Author: Koji Yokota <[email protected]>
Date:   Thu Jun 11 19:57:21 2026 +0900

    Fix IM color mixing
---
 src/frontends/qt/ColorCache.cpp     | 2 +-
 src/frontends/qt/GuiInputMethod.cpp | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 135c2f362a..785c4d5c64 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -240,7 +240,7 @@ const QColor qcolorOverlay(const QColor &fg, const QColor &bg)
 	int red, green, blue, alpha;
 
 	float fg_weight = fg.alphaF();
-	float bg_weight = (1 - fg.alphaF()) * bg.alphaF();
+	float bg_weight = 1 - fg.alphaF();
 
 	red   = std::round((fg_weight*fg.redF()   + bg_weight*bg.redF()  ) * 255);
 	green = std::round((fg_weight*fg.greenF() + bg_weight*bg.greenF()) * 255);
diff --git a/src/frontends/qt/GuiInputMethod.cpp b/src/frontends/qt/GuiInputMethod.cpp
index e36fa31475..e7072024a3 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -545,9 +545,9 @@ pos_type GuiInputMethod::setTextFormat(const QInputMethodEvent::Attribute & it,
 	QColor im_fg = char_format.foreground().color();
 	QColor im_bg = char_format.background().color();
 	// if incoming char_format doesn't specify the color (#000000)
-	// just use the text background as a base color
+	// use transparent white as a base color which is neutral to overlaid color
 	if (im_bg == QColorConstants::Black)
-		im_bg = guiApp->colorCache().get(Color_background);
+		im_bg = QColor(255,255,255,0);
 
 	// overlay theme's color on char_format's base color
 	// theme's color is the system color if "Use system colors" is checked
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs