commit 75144295fd16d7bdcb7fc6562b19fb99fe2c4336
Author: Koji Yokota <[email protected]>
Date:   Fri Jul 11 01:03:35 2025 +0900

    Make all preedit colors editable
---
 lib/themes/Default.theme            |  6 ++++--
 lib/themes/Monochrome.theme         |  6 ++++--
 lib/themes/Solarized.theme          |  6 ++++--
 src/Color.cpp                       |  2 ++
 src/ColorCode.h                     |  4 ++++
 src/frontends/qt/ColorCache.cpp     |  2 ++
 src/frontends/qt/GuiInputMethod.cpp | 15 +++++++++++----
 7 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/lib/themes/Default.theme b/lib/themes/Default.theme
index 9c37f09a90..dce91c5a31 100644
--- a/lib/themes/Default.theme
+++ b/lib/themes/Default.theme
@@ -1,8 +1,8 @@
-#LyX version: 2.5.0
+#LyX version: 2.5.0~devel
 #
 #   This is a definition file of a color theme "Default" of LyX
 #
-#   Author: Koji Yokota
+#   Author: Koji Yokota ([email protected])
 #
 #   Syntax: \set_color "color name" "light color" "dark color"
 #
@@ -74,8 +74,10 @@
 \set_color "pagebreak" "#4169e1" "#4169e1"
 \set_color "paragraphmarker" "#cccccc" "#666666"
 \set_color "phantomtext" "#7f7f7f" "#7f7f7f"
+\set_color "preeditbg" "#faf0e6" "#000000"
 \set_color "preeditfocus" "#add8e6" "#add8e6"
 \set_color "preeditfocustext" "#000000" "#000000"
+\set_color "preedittext" "#000000" "#faf0e6"
 \set_color "previewframe" "#000000" "#faf0e6"
 \set_color "preview" "#000000" "#faf0e6"
 \set_color "regexpframe" "#008000" "#00ff00"
diff --git a/lib/themes/Monochrome.theme b/lib/themes/Monochrome.theme
index 46e8874625..4ab452bc22 100644
--- a/lib/themes/Monochrome.theme
+++ b/lib/themes/Monochrome.theme
@@ -1,8 +1,8 @@
-#LyX version: 2.5.0
+#LyX version: 2.5.0~devel
 #
 #   This is a definition file of a color theme "Monochrome" of LyX
 #
-#   Author: Koji Yokota
+#   Author: Koji Yokota ([email protected])
 #
 #   Syntax: \set_color "color name" "light color" "dark color"
 #
@@ -74,8 +74,10 @@
 \set_color "pagebreak" "#0000cd" "#8080ff"
 \set_color "paragraphmarker" "#cccccc" "#666666"
 \set_color "phantomtext" "#7f7f7f" "#7f7f7f"
+\set_color "preeditbg" "#fbfbfb" "#333334"
 \set_color "preeditfocus" "#cccccc" "#999999"
 \set_color "preeditfocustext" "#272727" "#000000"
+\set_color "preedittext" "#191919" "#e0e0e0"
 \set_color "previewframe" "#191919" "#faf0e6"
 \set_color "preview" "#191919" "#e0e0e0"
 \set_color "regexpframe" "#008000" "#00b200"
diff --git a/lib/themes/Solarized.theme b/lib/themes/Solarized.theme
index c0b43091e6..4522ee5421 100644
--- a/lib/themes/Solarized.theme
+++ b/lib/themes/Solarized.theme
@@ -1,8 +1,8 @@
-#LyX version: 2.5.0
+#LyX version: 2.5.0~devel
 #
 #   This is a definition file of a color theme "Solarized" of LyX
 #
-#   Author: Koji Yokota
+#   Author: Koji Yokota ([email protected])
 #
 #   Syntax: \set_color "color name" "light color" "dark color"
 #
@@ -74,8 +74,10 @@
 \set_color "pagebreak" "#268bd2" "#268bd2"
 \set_color "paragraphmarker" "#8abeb7" "#8abeb7"
 \set_color "phantomtext" "#7f7f7f" "#7f7f7f"
+\set_color "preeditbg" "#fdf6e3" "#002b36"
 \set_color "preeditfocus" "#93a1a1" "#586e75"
 \set_color "preeditfocustext" "#fdf6e3" "#002b36"
+\set_color "preedittext" "#657b83" "#839496"
 \set_color "previewframe" "#657b83" "#839496"
 \set_color "preview" "#657b83" "#839496"
 \set_color "regexpframe" "#008000" "#00ff00"
diff --git a/src/Color.cpp b/src/Color.cpp
index f757219df1..ecb72eca87 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -268,6 +268,8 @@ ColorSet::ColorSet()
        { Color_selectiontext, N_("selected text"), "selectiontext", black, 
black, "selectiontext" },
        { Color_preeditfocus, N_("preedit focus background"), "preeditfocus", 
"#add8e6", "#add8e6", "preeditfocus" },
        { Color_preeditfocustext, N_("preedit focus text"), "preeditfocustext", 
black, black, "preeditfocustext" },
+       { Color_preeditbg, N_("preedit background"), "preeditbg", Linen, black, 
"preeditbg" },
+       { Color_preedittext, N_("preedit text"), "preedittext", black, Linen, 
"preedittext" },
        { Color_latex, N_("LaTeX text"), "latex", DarkRed, "#D66613", "latex" },
        { Color_textlabel1, N_("Text label 1"), "textlabel1", blue, "#86a4ff", 
"textlabel1" },
        { Color_textlabel2, N_("Text label 2"), "textlabel2", Green, green, 
"textlabel2" },
diff --git a/src/ColorCode.h b/src/ColorCode.h
index 8cd3e9cc62..c0cdaaadee 100644
--- a/src/ColorCode.h
+++ b/src/ColorCode.h
@@ -73,6 +73,10 @@ enum ColorCode {
        Color_preeditfocus,
        /// Text color of the focused segment of the preedit
        Color_preeditfocustext,
+       /// Background color of the focused segment of the preedit
+       Color_preeditbg,
+       /// Text color of the focused segment of the preedit
+       Color_preedittext,
        /// Text color in LaTeX mode
        Color_latex,
        /// The color used for previews
diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index bf95d974c8..5a1248a90a 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -31,6 +31,7 @@ QPalette::ColorRole role(ColorCode col)
        case Color_graphicsbg:
        case Color_mathmacrobg:
        case Color_mathcorners:
+       case Color_preeditbg:
                return QPalette::Base;
                break;
 
@@ -39,6 +40,7 @@ QPalette::ColorRole role(ColorCode col)
        case Color_preview:
        case Color_tabularline:
        case Color_previewframe:
+       case Color_preedittext:
                return QPalette::Text;
                break;
 
diff --git a/src/frontends/qt/GuiInputMethod.cpp 
b/src/frontends/qt/GuiInputMethod.cpp
index f20fbb7a6f..62f2608fb7 100644
--- a/src/frontends/qt/GuiInputMethod.cpp
+++ b/src/frontends/qt/GuiInputMethod.cpp
@@ -460,12 +460,19 @@ pos_type GuiInputMethod::setTextFormat(const 
QInputMethodEvent::Attribute & it,
 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
        // set the style of a focused sector as specified by color themes
        // it uses a system color if "Use system colors" is checked
+       QBrush fgbrush;
+       QBrush bgbrush;
        if (char_format.background().color() != QColorConstants::Black) {
-               QBrush 
fgbrush(guiApp->colorCache().get(Color_preeditfocustext));
-               QBrush bgbrush(guiApp->colorCache().get(Color_preeditfocus));
-               char_format.setForeground(fgbrush);
-               char_format.setBackground(bgbrush);
+               
fgbrush.setColor(guiApp->colorCache().get(Color_preeditfocustext));
+               bgbrush.setColor(guiApp->colorCache().get(Color_preeditfocus));
+       } else {
+               fgbrush.setColor(guiApp->colorCache().get(Color_preedittext));
+               bgbrush.setColor(guiApp->colorCache().get(Color_preeditbg));
        }
+       fgbrush.setStyle(Qt::SolidPattern);
+       bgbrush.setStyle(Qt::SolidPattern);
+       char_format.setForeground(fgbrush);
+       char_format.setBackground(bgbrush);
 #endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
 
        // The void "cursor segment" in the composing mode comes with it.start 
> 0 and
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to