[LyX/master] ColorSet::setColor should accept named colors
Koji Yokota
yokota at lyx.org
Thu Jun 4 16:50:12 UTC 2026
commit 7344638959ae08c3b9565441500e1b204be1e915
Author: Koji Yokota <yokota at lyx.org>
Date: Fri Jun 5 01:48:46 2026 +0900
ColorSet::setColor should accept named colors
---
src/Color.cpp | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)
diff --git a/src/Color.cpp b/src/Color.cpp
index 4ba9a69d46..5cca791389 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -522,23 +522,16 @@ bool ColorSet::setColor(ColorCode col, string const & hexname,
return false;
}
- LASSERT((hexname.empty()
- || ((hexname.size() == 7 || hexname.size() == 9)
- && hexname[0] == '#'))
- && (darkhexname.empty()
- || ((darkhexname.size() == 7 || darkhexname.size() == 9)
- && darkhexname[0] == '#')),
- return true);
-
if (!hexname.empty())
- it->second.hex32name = hexname.size() == 7 ?
+ it->second.hex32name = hexname[0] == '#' && hexname.size() == 7 ?
"#ff" + hexname.substr(1, 6) : hexname;
if (!darkhexname.empty())
- it->second.darkhex32name = darkhexname.size() == 7 ?
+ it->second.darkhex32name =
+ darkhexname[0] == '#' && darkhexname.size() == 7 ?
"#ff" + darkhexname.substr(1, 6) : darkhexname;
else
- it->second.darkhex32name = hexname.size() == 7 ?
+ it->second.darkhex32name = hexname[0] == '#' && hexname.size() == 7 ?
"#ff" + hexname.substr(1, 6) : hexname;
return true;
}
More information about the lyx-cvs
mailing list