[LyX/master] Fix IM color mixing
Koji Yokota
yokota at lyx.org
Thu Jun 11 10:57:25 UTC 2026
commit 66e8e2c014d5f359f60279123319b696b6a51c92
Author: Koji Yokota <yokota at lyx.org>
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
More information about the lyx-cvs
mailing list