commit 207b7066ebe8670e23e91f9b495801bf0623a3e7 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sun Feb 23 10:25:15 2025 +0100
Fix box color validation --- src/insets/InsetBox.cpp | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/src/insets/InsetBox.cpp b/src/insets/InsetBox.cpp index 5c11fc2886..311e46fb3c 100644 --- a/src/insets/InsetBox.cpp +++ b/src/insets/InsetBox.cpp @@ -799,8 +799,17 @@ void InsetBox::validate(LaTeXFeatures & features) const BoxType btype = boxtranslator().find(params_.type); switch (btype) { case Frameless: - if (params_.backgroundcolor != "none") - features.require("xcolor"); + if (params_.backgroundcolor != "none") { + if (theLaTeXColors().isLaTeXColor(params_.backgroundcolor)) { + LaTeXColor const lc = theLaTeXColors().getLaTeXColor(params_.backgroundcolor); + for (auto const & r : lc.req()) + features.require(r); + features.require("xcolor"); + if (!lc.model().empty()) + features.require("xcolor:" + lc.model()); + } else + features.require("color"); + } break; case Framed: features.require("calc"); @@ -808,9 +817,29 @@ void InsetBox::validate(LaTeXFeatures & features) const break; case Boxed: features.require("calc"); - if (useFColorBox()) - // \fcolorbox is provided by [x]color - features.require("xcolor"); + if (useFColorBox()) { + bool need_xcolor = false; + if (theLaTeXColors().isLaTeXColor(params_.backgroundcolor)) { + LaTeXColor const lc = theLaTeXColors().getLaTeXColor(params_.backgroundcolor); + for (auto const & r : lc.req()) + features.require(r); + features.require("xcolor"); + need_xcolor = true; + if (!lc.model().empty()) + features.require("xcolor:" + lc.model()); + } + if (theLaTeXColors().isLaTeXColor(params_.framecolor)) { + LaTeXColor const lc = theLaTeXColors().getLaTeXColor(params_.framecolor); + for (auto const & r : lc.req()) + features.require(r); + features.require("xcolor"); + need_xcolor = true; + if (!lc.model().empty()) + features.require("xcolor:" + lc.model()); + } + if (!need_xcolor) + features.require("color"); + } break; case ovalbox: case Ovalbox: -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs