[LyX/master] Fix Color::X11hexname()

Koji Yokota <[email protected]> Fri, 05 Jun 2026 16:29:46 +0000
Newsgroups gmane.editors.lyx.cvs
Message-ID <[email protected]>
commit e1d8cfa0862e3136065b51b620c43cb3c87ff219
Author: Koji Yokota <[email protected]>
Date:   Sat Jun 6 01:29:26 2026 +0900

    Fix Color::X11hexname()
---
 src/Color.cpp | 18 +++++++++++++++---
 src/Color.h   |  1 +
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/Color.cpp b/src/Color.cpp
index 7b7cc40c40..a032fa8f20 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -69,9 +69,6 @@ string const X11hexname(RGBColor const & col)
 
 	ostr << '#' << setbase(16) << setfill('0');
 
-	if (typeid(col) == typeid(ARGBColor))
-		ostr << setw(2) << ((ARGBColor const &)col).a;
-
 	ostr << setw(2) << col.r
 	     << setw(2) << col.g
 	     << setw(2) << col.b;
@@ -80,6 +77,21 @@ string const X11hexname(RGBColor const & col)
 }
 
 
+string const X11hexname(ARGBColor const & col)
+{
+	ostringstream ostr;
+
+	ostr << '#' << setbase(16) << setfill('0');
+
+	ostr << setw(2) << col.a
+		 << setw(2) << col.r
+	     << setw(2) << col.g
+	     << setw(2) << col.b;
+
+	return ostr.str();
+}
+
+
 RGBColor rgbFromHexName(string const & hexname)
 {
 	// hexname accepts both 16bit and 32bit hex codes
diff --git a/src/Color.h b/src/Color.h
index 8ba9587831..94df2bff3b 100644
--- a/src/Color.h
+++ b/src/Color.h
@@ -60,6 +60,7 @@ public:
 std::ostream & operator<<(std::ostream & os, Color color);
 
 std::string const X11hexname(RGBColor const & col);
+std::string const X11hexname(ARGBColor const & col);
 /// Returns RGBColor from 16- or 32-bit hex name
 /// Alpha value is omitted for 32-bit hex name
 RGBColor rgbFromHexName(std::string const & hexname);
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs