[LyX/master] Let Color::getX11HexName() output named colors correctly
Koji Yokota <[email protected]> Fri, 05 Jun 2026 05:46:54 +0000
| Newsgroups | gmane.editors.lyx.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit b593bb0b91566d55841ac1e89b741743e513c5bb Author: Koji Yokota <[email protected]> Date: Fri Jun 5 14:44:05 2026 +0900 Let Color::getX11HexName() output named colors correctly --- src/Color.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Color.cpp b/src/Color.cpp index 5cca791389..7b7cc40c40 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -425,9 +425,16 @@ docstring const ColorSet::getGUIName(ColorCode c) const string const ColorSet::getX11HexName(ColorCode c, bool const darkmode) const { InfoTab::const_iterator it = infotab.find(c); - if (it != infotab.end()) - return darkmode ? "#" + it->second.darkhex32name.substr(3, 6) : - "#" + it->second.hex32name.substr(3, 6); + if (it != infotab.end()) { + if (darkmode) + return it->second.darkhex32name[0] == '#' ? + "#" + it->second.darkhex32name.substr(3, 6) : + it->second.darkhex32name; + else + return it->second.hex32name[0] == '#' ? + "#" + it->second.hex32name.substr(3, 6) : + it->second.hex32name; + } lyxerr << "LyX internal error: Missing color" " entry in Color.cpp for " << c << '\n' @@ -446,8 +453,7 @@ pair<string, string> const ColorSet::getAllX11HexNames(ColorCode c) const { InfoTab::const_iterator it = infotab.find(c); if (it != infotab.end()) - return make_pair("#" + it->second.hex32name.substr(3, 6), - "#" + it->second.darkhex32name.substr(3, 6)); + return make_pair(getX11HexName(c, false), getX11HexName(c, true)); lyxerr << "LyX internal error: Missing color" " entry in Color.cpp for " << c << '\n' -- lyx-cvs mailing list [email protected] https://lists.lyx.org/mailman/listinfo/lyx-cvs