[LyX/master] Improve some inset colors in special background contexts (#13320)
Juergen Spitzmueller
spitz at lyx.org
Thu Jun 4 14:23:37 UTC 2026
commit 9ae654e7c71102f3a5e5dd05e3609d9f2304d4f8
Author: Juergen Spitzmueller <spitz at lyx.org>
Date: Thu Jun 4 16:22:48 2026 +0200
Improve some inset colors in special background contexts (#13320)
---
src/Color.cpp | 8 ++--
src/insets/Inset.cpp | 54 +++++++++++++++++++++++++++
src/insets/Inset.h | 4 ++
src/insets/InsetNewline.cpp | 16 ++++----
src/insets/InsetNewline.h | 2 +-
src/insets/InsetQuotes.cpp | 16 +-------
src/insets/InsetSpace.cpp | 83 +++++++++++++++++++++--------------------
src/insets/InsetSpecialChar.cpp | 8 ++--
src/insets/InsetTextbreak.cpp | 24 ++++++------
src/insets/InsetTextbreak.h | 2 +-
src/insets/InsetVSpace.cpp | 13 ++++---
11 files changed, 140 insertions(+), 90 deletions(-)
diff --git a/src/Color.cpp b/src/Color.cpp
index f277de10b4..4ba9a69d46 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -312,7 +312,7 @@ ColorSet::ColorSet()
{ Color_nonunique_inlinecompletion, N_("inline completion (non-unique)"),
"nonuniqueinlinecompletion", grey80, grey60, "nonuniqueinlinecompletion" },
{ Color_notelabel, N_("note label"), "note", yellow, "#ffff6200", "note" },
- { Color_notebg, N_("note background"), "notebg", yellow, "#ff5b5903", "notebg" },
+ { Color_notebg, N_("note background"), "notebg", yellow, yellow, "notebg" },
{ Color_commentlabel, N_("comment label"), "comment", magenta, olive, "comment" },
{ Color_commentbg, N_("comment background"), "commentbg", Linen, black, "commentbg" },
{ Color_greyedoutlabel, N_("greyedout inset label"), "greyedout", "#ffff0080", "#ffff0080", "greyedout" },
@@ -358,9 +358,9 @@ ColorSet::ColorSet()
{ Color_insetframe, N_("inset frame"), "insetframe", IndianRed, IndianRed, "insetframe" },
{ Color_insetlabel, N_("inset label"), "insetlabel", black, black, "insetlabel" },
{ Color_error, N_("LaTeX error"), "error", red, DarkRed, "error" },
- { Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, Brown, "eolmarker" },
- { Color_added_space, N_("added space markers"), "added_space", Brown, Brown, "added_space" },
- { Color_appendix, N_("appendix marker"), "appendix", Brown, Brown, "appendix" },
+ { Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, "#ffffbfbf", "eolmarker" },
+ { Color_added_space, N_("added space markers"), "added_space", Brown, "#ffffbfbf", "added_space" },
+ { Color_appendix, N_("appendix marker"), "appendix", Brown, "#ffffbfbf", "appendix" },
{ Color_changebar, N_("change bar"), "changebar", blue, "#ff86a4ff", "changebar" },
{ Color_deletedtext_output, N_("changes - deleted text (exported output)"), "deletedtext", "#ffff0000", "#ffff0000", "deletedtext" },
{ Color_addedtext_output, N_("changes - added text (exported output)"), "addedtext", "#ff0000ff", "#ff0000ff", "addedtext" },
diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp
index b208d14c7f..806c772da6 100644
--- a/src/insets/Inset.cpp
+++ b/src/insets/Inset.cpp
@@ -20,6 +20,7 @@
#include "BufferList.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "ColorSet.h"
#include "CoordCache.h"
#include "Cursor.h"
#include "Dimension.h"
@@ -302,6 +303,59 @@ FontInfo Inset::getLabelfont() const
}
+Color Inset::getModeDependentColor(PainterInfo & pi) const
+{
+ FontInfo font = pi.base.font;
+ bool invert = false;
+ if (theApp() && theApp()->isInDarkMode()) {
+ if (font.color() == Color_none
+ && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(pi.background_color, true))))
+ invert = true;
+ else if (pi.background_color == Color_background
+ && font.color() != Color_none
+ && !theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(font.color()))))
+ invert = true;
+ }
+ Color rc = font.realColor(invert);
+ if (invert && rc == font.color())
+ // We are in dark mode and have a dark text color.
+ // Brighten that for workarea display (#13218)
+ rc.mergeColor = Color_foreground;
+ return rc;
+}
+
+
+Color Inset::getModeDependentColor(ColorCode const fgc, ColorCode const bgc) const
+{
+ bool invert = false;
+ bool darken = false;
+ if (theApp() && theApp()->isInDarkMode()) {
+ if (fgc == Color_none
+ && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(bgc, true))))
+ invert = true;
+ else if (bgc == Color_background
+ && fgc != Color_none
+ && !theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(fgc, true))))
+ invert = true;
+ else if (bgc != Color_background
+ && fgc != Color_none
+ && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(fgc, true)))
+ && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(bgc, true))))
+ darken = true;
+ }
+ Color res = fgc;
+ if (invert)
+ // We are in dark mode and have a dark text color.
+ // Brighten that for workarea display (#13218)
+ res.mergeColor = Color_foreground;
+ else if (darken)
+ // We are in dark mode and have a dark text color.
+ // Brighten that for workarea display (#13218)
+ res.mergeColor = Color_background;
+ return res;
+}
+
+
docstring Inset::toolTip(BufferView const &, int, int) const
{
return docstring();
diff --git a/src/insets/Inset.h b/src/insets/Inset.h
index 9b336b147b..206b2c1b6c 100644
--- a/src/insets/Inset.h
+++ b/src/insets/Inset.h
@@ -634,6 +634,10 @@ public:
virtual ColorCode backgroundColor(PainterInfo const &) const;
///
virtual ColorCode labelColor() const;
+ ///
+ Color getModeDependentColor(PainterInfo & pi) const;
+ ///
+ Color getModeDependentColor(ColorCode const fgc, ColorCode const bgc) const;
/// Determine the action of backspace and delete: do we select instead of
/// deleting if not already selected?
diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp
index 4e24736965..d12eafa07f 100644
--- a/src/insets/InsetNewline.cpp
+++ b/src/insets/InsetNewline.cpp
@@ -136,14 +136,14 @@ bool InsetNewline::getStatus(Cursor & cur, FuncRequest const & cmd,
}
-ColorCode InsetNewline::ColorName() const
+Color InsetNewline::ColorName(ColorCode const bgc) const
{
switch (params_.kind) {
case InsetNewlineParams::NEWLINE:
- return Color_eolmarker;
+ return getModeDependentColor(Color_eolmarker, bgc);
break;
case InsetNewlineParams::LINEBREAK:
- return Color_pagebreak;
+ return getModeDependentColor(Color_pagebreak, bgc);
break;
}
// not really useful, but to avoids gcc complaints
@@ -195,7 +195,7 @@ void InsetNewline::xhtml(XMLStream & xs, OutputParams const &) const
void InsetNewline::draw(PainterInfo & pi, int x, int y) const
{
FontInfo font;
- font.setColor(ColorName());
+ font.setPaintColor(ColorName(pi.background_color));
frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
int const wid = fm.width('n');
@@ -218,7 +218,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
xp[2] = int(x + wid * 0.625);
}
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
yp[0] = int(y - 0.500 * asc * 0.75);
yp[1] = int(y - 0.500 * asc * 0.75);
@@ -234,7 +234,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
xp[2] = int(x);
}
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
if (params_.kind == InsetNewlineParams::LINEBREAK) {
@@ -249,7 +249,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
xp[1] = int(x - wid);
xp[2] = int(x - wid);
}
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
yp[0] = int(y - 0.875 * asc * 0.75);
yp[1] = int(y - 0.500 * asc * 0.75);
@@ -264,7 +264,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
xp[1] = int(x - wid);
xp[2] = int(x - wid * 0.625);
}
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
}
}
diff --git a/src/insets/InsetNewline.h b/src/insets/InsetNewline.h
index e4f70b4e67..b5c6803115 100644
--- a/src/insets/InsetNewline.h
+++ b/src/insets/InsetNewline.h
@@ -76,7 +76,7 @@ private:
/// a line separator)?
bool isSpace() const override { return true; }
///
- ColorCode ColorName() const;
+ Color ColorName(ColorCode const bgc) const;
///
std::string contextMenuName() const override;
///
diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp
index 357987025f..55a9802199 100644
--- a/src/insets/InsetQuotes.cpp
+++ b/src/insets/InsetQuotes.cpp
@@ -705,21 +705,7 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
if (style_ == QuoteStyle::Dynamic)
font.setPaintColor(Color_special);
else {
- bool invert = false;
- if (theApp() && theApp()->isInDarkMode()) {
- if (font.color() == Color_none
- && theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(pi.background_color, true))))
- invert = true;
- else if (pi.background_color == Color_background
- && font.color() != Color_none
- && !theApp()->isLightColor(rgbFromHexName(lcolor.getX11HexName(font.color()))))
- invert = true;
- }
- Color rc = font.realColor(invert);
- if (invert && rc == font.color())
- // We are in dark mode and have a dark text color.
- // Brighten that for workarea display (#13218)
- rc.mergeColor = Color_foreground;
+ Color rc = getModeDependentColor(pi);
font.setPaintColor(pi.textColor(rc));
}
pi.pain.text(x, y, displayString(), font);
diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp
index 5c8a5d545b..289455fea0 100644
--- a/src/insets/InsetSpace.cpp
+++ b/src/insets/InsetSpace.cpp
@@ -317,59 +317,62 @@ void InsetSpace::draw(PainterInfo & pi, int x, int y) const
int const xml = xm - xoffset;
int const xmr = xm + xoffset;
+ Color added = getModeDependentColor(Color_added_space, pi.background_color);
+ Color latex = getModeDependentColor(Color_latex, pi.background_color);
+ Color special = getModeDependentColor(Color_special, pi.background_color);
if (params_.kind == InsetSpaceParams::HFILL) {
- pi.pain.line(x0, y1, x0, y0, Color_added_space);
- pi.pain.line(x0, y2, x1, y2, Color_added_space,
+ pi.pain.line(x0, y1, x0, y0, added);
+ pi.pain.line(x0, y2, x1, y2, added,
frontend::Painter::line_onoffdash);
- pi.pain.line(x1, y1, x1, y0, Color_added_space);
+ pi.pain.line(x1, y1, x1, y0, added);
} else if (params_.kind == InsetSpaceParams::HFILL_PROTECTED) {
- pi.pain.line(x0, y1, x0, y0, Color_latex);
- pi.pain.line(x0, y2, x1, y2, Color_latex,
+ pi.pain.line(x0, y1, x0, y0, latex);
+ pi.pain.line(x0, y2, x1, y2, latex,
frontend::Painter::line_onoffdash);
- pi.pain.line(x1, y1, x1, y0, Color_latex);
+ pi.pain.line(x1, y1, x1, y0, latex);
} else if (params_.kind == InsetSpaceParams::DOTFILL) {
- pi.pain.line(x0, y1, x0, y0, Color_special);
- pi.pain.line(x0, y0, x1, y0, Color_special,
+ pi.pain.line(x0, y1, x0, y0, special);
+ pi.pain.line(x0, y0, x1, y0, special,
frontend::Painter::line_onoffdash);
- pi.pain.line(x1, y1, x1, y0, Color_special);
+ pi.pain.line(x1, y1, x1, y0, special);
} else if (params_.kind == InsetSpaceParams::HRULEFILL) {
- pi.pain.line(x0, y1, x0, y0, Color_special);
- pi.pain.line(x0, y0, x1, y0, Color_special);
- pi.pain.line(x1, y1, x1, y0, Color_special);
+ pi.pain.line(x0, y1, x0, y0, special);
+ pi.pain.line(x0, y0, x1, y0, special);
+ pi.pain.line(x1, y1, x1, y0, special);
} else if (params_.kind == InsetSpaceParams::LEFTARROWFILL) {
- pi.pain.line(x2, y1 + 1 , x0 + 1, y2, Color_special);
- pi.pain.line(x0 + 1, y2 + 1 , x2, y0, Color_special);
- pi.pain.line(x0, y2 , x1, y2, Color_special);
+ pi.pain.line(x2, y1 + 1 , x0 + 1, y2, special);
+ pi.pain.line(x0 + 1, y2 + 1 , x2, y0, special);
+ pi.pain.line(x0, y2 , x1, y2, special);
} else if (params_.kind == InsetSpaceParams::RIGHTARROWFILL) {
- pi.pain.line(x3 + 1, y1 + 1 , x1, y2, Color_special);
- pi.pain.line(x1, y2 + 1 , x3 + 1, y0, Color_special);
- pi.pain.line(x0, y2 , x1, y2, Color_special);
+ pi.pain.line(x3 + 1, y1 + 1 , x1, y2, special);
+ pi.pain.line(x1, y2 + 1 , x3 + 1, y0, special);
+ pi.pain.line(x0, y2 , x1, y2, special);
} else if (params_.kind == InsetSpaceParams::UPBRACEFILL) {
- pi.pain.line(x0 + 1, y1 + 1 , x2, y2, Color_special);
- pi.pain.line(x2, y2 , xml, y2, Color_special);
- pi.pain.line(xml + 1, y2 + 1 , xm, y0, Color_special);
- pi.pain.line(xm + 1, y0 , xmr, y2 + 1, Color_special);
- pi.pain.line(xmr, y2 , x3, y2, Color_special);
- pi.pain.line(x3 + 1, y2 , x1, y1 + 1, Color_special);
+ pi.pain.line(x0 + 1, y1 + 1 , x2, y2, special);
+ pi.pain.line(x2, y2 , xml, y2, special);
+ pi.pain.line(xml + 1, y2 + 1 , xm, y0, special);
+ pi.pain.line(xm + 1, y0 , xmr, y2 + 1, special);
+ pi.pain.line(xmr, y2 , x3, y2, special);
+ pi.pain.line(x3 + 1, y2 , x1, y1 + 1, special);
} else if (params_.kind == InsetSpaceParams::DOWNBRACEFILL) {
- pi.pain.line(x0 + 1, y0 , x2, y2 + 1, Color_special);
- pi.pain.line(x2, y2 , xml, y2, Color_special);
- pi.pain.line(xml + 1, y2 , xm, y1 + 1, Color_special);
- pi.pain.line(xm + 1, y1 + 1 , xmr, y2, Color_special);
- pi.pain.line(xmr, y2 , x3, y2, Color_special);
- pi.pain.line(x3 + 1, y2 + 1 , x1, y0, Color_special);
+ pi.pain.line(x0 + 1, y0 , x2, y2 + 1, special);
+ pi.pain.line(x2, y2 , xml, y2, special);
+ pi.pain.line(xml + 1, y2 , xm, y1 + 1, special);
+ pi.pain.line(xm + 1, y1 + 1 , xmr, y2, special);
+ pi.pain.line(xmr, y2 , x3, y2, special);
+ pi.pain.line(x3 + 1, y2 + 1 , x1, y0, special);
} else if (params_.kind == InsetSpaceParams::CUSTOM) {
- pi.pain.line(x0, y1 + 1 , x2 + 1, y2, Color_special);
- pi.pain.line(x2 + 1, y2 + 1 , x0, y0, Color_special);
- pi.pain.line(x1 + 1, y1 + 1 , x3, y2, Color_special);
- pi.pain.line(x3, y2 + 1 , x1 + 1, y0, Color_special);
- pi.pain.line(x2, y2 , x3, y2, Color_special);
+ pi.pain.line(x0, y1 + 1 , x2 + 1, y2, special);
+ pi.pain.line(x2 + 1, y2 + 1 , x0, y0, special);
+ pi.pain.line(x1 + 1, y1 + 1 , x3, y2, special);
+ pi.pain.line(x3, y2 + 1 , x1 + 1, y0, special);
+ pi.pain.line(x2, y2 , x3, y2, special);
} else if (params_.kind == InsetSpaceParams::CUSTOM_PROTECTED) {
- pi.pain.line(x0, y1 + 1 , x2 + 1, y2, Color_latex);
- pi.pain.line(x2 + 1, y2 + 1 , x0, y0, Color_latex);
- pi.pain.line(x1 + 1, y1 + 1 , x3, y2, Color_latex);
- pi.pain.line(x3, y2 + 1 , x1 + 1, y0, Color_latex);
- pi.pain.line(x2, y2 , x3, y2, Color_latex);
+ pi.pain.line(x0, y1 + 1 , x2 + 1, y2, latex);
+ pi.pain.line(x2 + 1, y2 + 1 , x0, y0, latex);
+ pi.pain.line(x1 + 1, y1 + 1 , x3, y2, latex);
+ pi.pain.line(x3, y2 + 1 , x1 + 1, y0, latex);
+ pi.pain.line(x2, y2 , x3, y2, latex);
}
return;
}
diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp
index afb9e4d681..95594c11bf 100644
--- a/src/insets/InsetSpecialChar.cpp
+++ b/src/insets/InsetSpecialChar.cpp
@@ -198,11 +198,13 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
FontInfo font = pi.base.font;
if (unknown_) {
- font.setColor(Color_error);
+ font.setPaintColor(getModeDependentColor(Color_error, pi.background_color));
pi.pain.text(x, y, from_ascii("??"), font);
return;
}
+ Color special = getModeDependentColor(Color_special, pi.background_color);
+
if (kind_ == "allowbreak") {
// A small vertical line
int const asc = theFontMetrics(pi.base.font).xHeight();
@@ -211,7 +213,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
int const x1 = x; // x - 1; // similar to LibreOffice?
int const y0 = y + desc;
int const y1 = y - asc / 3;
- pi.pain.line(x0, y1, x1, y0, Color_special);
+ pi.pain.line(x0, y1, x1, y0, special);
return;
}
if (kind_ == "LyX" || kind_ == "TeX" || kind_ == "LaTeX" || kind_ == "LaTeX2e") {
@@ -226,7 +228,7 @@ void InsetSpecialChar::draw(PainterInfo & pi, int x, int y) const
// ▹ U+25B9 WHITE RIGHT-POINTING SMALL TRIANGLE
// ◃ U+25C3 WHITE LEFT-POINTING SMALL TRIANGLE
char_type const c = pi.ltr_pos ? 0x25B9 : 0x25C3;
- font.setColor(Color_special);
+ font.setPaintColor(special);
pi.pain.text(x, y, c, font);
return;
}
diff --git a/src/insets/InsetTextbreak.cpp b/src/insets/InsetTextbreak.cpp
index 9dd4c8d08d..dd69fb0816 100644
--- a/src/insets/InsetTextbreak.cpp
+++ b/src/insets/InsetTextbreak.cpp
@@ -131,7 +131,7 @@ void InsetTextbreak::draw(PainterInfo & pi, int x, int y) const
if (params_.kind == InsetTextbreakParams::NOPAGEBREAK) {
FontInfo font;
- font.setColor(ColorName());
+ font.setPaintColor(ColorName(pi.background_color));
frontend::FontMetrics const & fm = theFontMetrics(pi.base.font);
int const wid = 3 * fm.width('n');
@@ -147,12 +147,12 @@ void InsetTextbreak::draw(PainterInfo & pi, int x, int y) const
xp[0] = int(x + wid * 0.25);
xp[1] = int(x + wid * 0.4);
xp[2] = int(x + wid * 0.25);
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
yp[0] = yp[1] = int(y - 0.500 * asc * 0.75);
xp[0] = int(x + wid * 0.03);
xp[1] = int(x + wid * 0.4);
- pi.pain.lines(xp, yp, 2, ColorName());
+ pi.pain.lines(xp, yp, 2, ColorName(pi.background_color));
//right side arrow
yp[0] = int(y - 0.875 * asc * 0.75);
@@ -161,25 +161,25 @@ void InsetTextbreak::draw(PainterInfo & pi, int x, int y) const
xp[0] = int(x + wid * 0.75);
xp[1] = int(x + wid * 0.6);
xp[2] = int(x + wid * 0.75);
- pi.pain.lines(xp, yp, 3, ColorName());
+ pi.pain.lines(xp, yp, 3, ColorName(pi.background_color));
yp[0] = yp[1] = int(y - 0.500 * asc * 0.75);
xp[0] = int(x + wid * 0.97);
xp[1] = int(x + wid * 0.6);
- pi.pain.lines(xp, yp, 2, ColorName());
+ pi.pain.lines(xp, yp, 2, ColorName(pi.background_color));
//mid-rule
xp[0] = xp[1] = int(x + wid * 0.5);
yp[0] = int(y - 0.875 * asc * 0.75);
yp[1] = int(y - 0.125 * asc * 0.75);
- pi.pain.lines(xp, yp, 2, ColorName());
+ pi.pain.lines(xp, yp, 2, ColorName(pi.background_color));
return;
}
using frontend::Painter;
FontInfo font;
- font.setColor(ColorName());
+ font.setPaintColor(ColorName(pi.background_color));
font.decSize();
Dimension const dim = dimension(*pi.base.bv);
@@ -196,9 +196,9 @@ void InsetTextbreak::draw(PainterInfo & pi, int x, int y) const
Color_none, Color_none);
pi.pain.line(x, y, text_start, y,
- ColorName(), Painter::line_onoffdash);
+ ColorName(pi.background_color), Painter::line_onoffdash);
pi.pain.line(text_end, y, int(x + dim.wid), y,
- ColorName(), Painter::line_onoffdash);
+ ColorName(pi.background_color), Painter::line_onoffdash);
}
@@ -264,17 +264,17 @@ docstring InsetTextbreak::insetLabel() const
}
-ColorCode InsetTextbreak::ColorName() const
+Color InsetTextbreak::ColorName(ColorCode const bgc) const
{
switch (params_.kind) {
case InsetTextbreakParams::PAGEBREAK:
case InsetTextbreakParams::NOPAGEBREAK:
- return Color_pagebreak;
+ return getModeDependentColor(Color_pagebreak, bgc);
case InsetTextbreakParams::NEWPAGE:
case InsetTextbreakParams::CLEARPAGE:
case InsetTextbreakParams::CLEARDOUBLEPAGE:
case InsetTextbreakParams::CONTEXTUAL:
- return Color_newpage;
+ return getModeDependentColor(Color_newpage, bgc);
}
// not really useful, but to avoids gcc complaints
return Color_newpage;
diff --git a/src/insets/InsetTextbreak.h b/src/insets/InsetTextbreak.h
index 33e211bf9e..bba66fef87 100644
--- a/src/insets/InsetTextbreak.h
+++ b/src/insets/InsetTextbreak.h
@@ -85,7 +85,7 @@ private:
///
docstring insetLabel() const;
///
- ColorCode ColorName() const;
+ Color ColorName(ColorCode const bgc) const;
///
std::string contextMenuName() const override;
///
diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp
index de634fca22..1c015d122b 100644
--- a/src/insets/InsetVSpace.cpp
+++ b/src/insets/InsetVSpace.cpp
@@ -185,7 +185,8 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
int d = 0;
FontInfo font;
- font.setColor(Color_added_space);
+ Color rc = getModeDependentColor(Color_added_space, pi.background_color);
+ font.setPaintColor(rc);
font.decSize();
font.decSize();
docstring const lab = label();
@@ -196,15 +197,15 @@ void InsetVSpace::draw(PainterInfo & pi, int x, int y) const
lab, font, Color_none, Color_none);
// top arrow
- pi.pain.line(x, ty1, midx, ty2, Color_added_space);
- pi.pain.line(midx, ty2, rightx, ty1, Color_added_space);
+ pi.pain.line(x, ty1, midx, ty2, rc);
+ pi.pain.line(midx, ty2, rightx, ty1, rc);
// bottom arrow
- pi.pain.line(x, by1, midx, by2, Color_added_space);
- pi.pain.line(midx, by2, rightx, by1, Color_added_space);
+ pi.pain.line(x, by1, midx, by2, rc);
+ pi.pain.line(midx, by2, rightx, by1, rc);
// joining line
- pi.pain.line(midx, ty2, midx, by2, Color_added_space);
+ pi.pain.line(midx, ty2, midx, by2, rc);
}
More information about the lyx-cvs
mailing list