[LyX/master] Use hexnames only for x11 colors

Juergen Spitzmueller spitz at lyx.org
Mon Aug 3 11:46:59 UTC 2020


commit 8415041b1f4d7a2e436e3f407bccd9a7e6bcdd87
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Mon Aug 3 14:10:46 2020 +0200

    Use hexnames only for x11 colors
    
    This prevents wrong color allocation with ambiguous names.
    
    Fixes #11828
    
    Patch by D. Ramöller with extensions by me.
---
 src/BufferParams.cpp                |    4 +-
 src/Color.cpp                       |  191 ++++++++++++++++++++---------------
 src/ColorSet.h                      |   14 ++--
 src/LaTeXFeatures.cpp               |    8 +-
 src/LyXRC.cpp                       |    4 +-
 src/frontends/qt/ColorCache.cpp     |    4 +-
 src/frontends/qt/GuiApplication.cpp |    2 +-
 src/frontends/qt/GuiPrefs.cpp       |    2 +-
 src/mathed/InsetMathHull.cpp        |    2 +-
 src/mathed/MathRow.cpp              |    2 +-
 10 files changed, 130 insertions(+), 103 deletions(-)

diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index 24bd102..f678e73 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -992,7 +992,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
 					branch_ptr->setColor(color);
 				// Update also the Color table:
 				if (color == "none")
-					color = lcolor.getX11Name(Color_background);
+					color = lcolor.getX11HexName(Color_background);
 				// FIXME UNICODE
 				lcolor.setColor(to_utf8(branch), color);
 			}
@@ -1021,7 +1021,7 @@ string BufferParams::readToken(Lexer & lex, string const & token,
 					index_ptr->setColor(color);
 				// Update also the Color table:
 				if (color == "none")
-					color = lcolor.getX11Name(Color_background);
+					color = lcolor.getX11HexName(Color_background);
 				// FIXME UNICODE
 				if (!shortcut.empty())
 					lcolor.setColor(to_utf8(shortcut), color);
diff --git a/src/Color.cpp b/src/Color.cpp
index d865765..6c5260f 100644
--- a/src/Color.cpp
+++ b/src/Color.cpp
@@ -41,7 +41,7 @@ struct ColorSet::ColorEntry {
 	ColorCode lcolor;
 	char const * guiname;
 	char const * latexname;
-	char const * x11name;
+	char const * x11hexname;
 	char const * lyxname;
 };
 
@@ -196,91 +196,118 @@ ColorSet::ColorSet()
 	char const * grey40 = "#666666";
 	char const * grey60 = "#999999";
 	char const * grey80 = "#cccccc";
+	// latex colors (xcolor package)
+	char const * black = "#000000";
+	char const * white = "#ffffff";
+	char const * blue = "#0000ff";
+	char const * brown = "#bf8040";
+	char const * cyan = "#00ffff";
+	char const * darkgray = "#404040";
+	char const * gray = "#808080";
+	char const * green = "#00ff00";
+	char const * lightgray = "#bfbfbf";
+	char const * lime = "#bfff00";
+	char const * magenta = "#ff00ff";
+	char const * olive = "#808000";
+	char const * orange = "#ff8000";
+	char const * pink = "#ffbfbf";
+	char const * purple = "#bf0040";
+	char const * red = "#ff0000";
+	char const * teal = "#008080";
+	char const * violet = "#800080";
+	char const * yellow = "#ffff00";
+	// svg colors
+	char const * Brown = "#a52a2a";
+	char const * DarkRed = "#8b0000";
+	char const * Green = "#008000";
+	char const * IndianRed = "#cd5c5c";
+	char const * Linen = "#faf0e6";
+	char const * RoyalBlue = "#4169e1";
+
 	//char const * grey90 = "#e5e5e5";
-	//  ColorCode, gui, latex, x11, lyx
+	//  ColorCode, gui, latex, x11hexname, lyx
 	// Warning: several of these entries are overridden in GuiApplication constructor
 	static ColorEntry const items[] = {
-	{ Color_none, N_("none"), "none", "black", "none" },
-	{ Color_black, N_("black"), "black", "black", "black" },
-	{ Color_white, N_("white"), "white", "white", "white" },
-	{ Color_blue, N_("blue"), "blue", "blue", "blue" },
-	{ Color_brown, N_("brown"), "brown", "brown", "brown" },
-	{ Color_cyan, N_("cyan"), "cyan", "cyan", "cyan" },
-	{ Color_darkgray, N_("darkgray"), "darkgray", "darkgray", "darkgray" },
-	{ Color_gray, N_("gray"), "gray", "gray", "gray" },
-	{ Color_green, N_("green"), "green", "green", "green" },
-	{ Color_lightgray, N_("lightgray"), "lightgray", "lightgray", "lightgray" },
-	{ Color_lime, N_("lime"), "lime", "lime", "lime" },
-	{ Color_magenta, N_("magenta"), "magenta", "magenta", "magenta" },
-	{ Color_olive, N_("olive"), "olive", "olive", "olive" },
-	{ Color_orange, N_("orange"), "orange", "orange", "orange" },
-	{ Color_pink, N_("pink"), "pink", "pink", "pink" },
-	{ Color_purple, N_("purple"), "purple", "purple", "purple" },
-	{ Color_red, N_("red"), "red", "red", "red" },
-	{ Color_teal, N_("teal"), "teal", "teal", "teal" },
-	{ Color_violet, N_("violet"), "violet", "violet", "violet" },
-	{ Color_yellow, N_("yellow"), "yellow", "yellow", "yellow" },
-	{ Color_cursor, N_("cursor"), "cursor", "black", "cursor" },
-	{ Color_background, N_("background"), "background", "linen", "background" },
-	{ Color_foreground, N_("text"), "foreground", "black", "foreground" },
-	{ Color_selection, N_("selection"), "selection", "LightBlue", "selection" },
-	{ Color_selectiontext, N_("selected text"),
-		"selectiontext", "black", "selectiontext" },
-	{ Color_latex, N_("LaTeX text"), "latex", "DarkRed", "latex" },
+	{ Color_none, N_("none"), "none", black, "none" },
+	{ Color_black, N_("black"), "black", black, "black" },
+	{ Color_white, N_("white"), "white", white, "white" },
+	{ Color_blue, N_("blue"), "blue", blue, "blue" },
+	{ Color_brown, N_("brown"), "brown", brown, "brown" },
+	{ Color_cyan, N_("cyan"), "cyan", cyan, "cyan" },
+	{ Color_darkgray, N_("darkgray"), "darkgray", darkgray, "darkgray" },
+	{ Color_gray, N_("gray"), "gray", gray, "gray" },
+	{ Color_green, N_("green"), "green", green, "green" },
+	{ Color_lightgray, N_("lightgray"), "lightgray", lightgray, "lightgray" },
+	{ Color_lime, N_("lime"), "lime", lime, "lime" },
+	{ Color_magenta, N_("magenta"), "magenta", magenta, "magenta" },
+	{ Color_olive, N_("olive"), "olive", olive, "olive" },
+	{ Color_orange, N_("orange"), "orange", orange, "orange" },
+	{ Color_pink, N_("pink"), "pink", pink, "pink" },
+	{ Color_purple, N_("purple"), "purple", purple, "purple" },
+	{ Color_red, N_("red"), "red", red, "red" },
+	{ Color_teal, N_("teal"), "teal", teal, "teal" },
+	{ Color_violet, N_("violet"), "violet", violet, "violet" },
+	{ Color_yellow, N_("yellow"), "yellow", yellow, "yellow" },
+	{ Color_cursor, N_("cursor"), "cursor", black, "cursor" },
+	{ Color_background, N_("background"), "background", Linen, "background" },
+	{ Color_foreground, N_("text"), "foreground", black, "foreground" },
+	{ Color_selection, N_("selection"), "selection", "#add8e6", "selection" },
+	{ Color_selectiontext, N_("selected text"), "selectiontext", black, "selectiontext" },
+	{ Color_latex, N_("LaTeX text"), "latex", DarkRed, "latex" },
 	{ Color_inlinecompletion, N_("inline completion"),
 		"inlinecompletion", grey60, "inlinecompletion" },
 	{ Color_nonunique_inlinecompletion, N_("non-unique inline completion"),
 		"nonuniqueinlinecompletion", grey80, "nonuniqueinlinecompletion" },
-	{ Color_preview, N_("previewed snippet"), "preview", "black", "preview" },
-	{ Color_notelabel, N_("note label"), "note", "yellow", "note" },
-	{ Color_notebg, N_("note background"), "notebg", "yellow", "notebg" },
-	{ Color_commentlabel, N_("comment label"), "comment", "magenta", "comment" },
-	{ Color_commentbg, N_("comment background"), "commentbg", "linen", "commentbg" },
+	{ Color_preview, N_("previewed snippet"), "preview", black, "preview" },
+	{ Color_notelabel, N_("note label"), "note", yellow, "note" },
+	{ Color_notebg, N_("note background"), "notebg", yellow, "notebg" },
+	{ Color_commentlabel, N_("comment label"), "comment", magenta, "comment" },
+	{ Color_commentbg, N_("comment background"), "commentbg", Linen, "commentbg" },
 	{ Color_greyedoutlabel, N_("greyedout inset label"), "greyedout", "#ff0080", "greyedout" },
 	{ Color_greyedouttext, N_("greyedout inset text"), "greyedouttext", grey80, "greyedouttext" },
-	{ Color_greyedoutbg, N_("greyedout inset background"), "greyedoutbg", "linen", "greyedoutbg" },
+	{ Color_greyedoutbg, N_("greyedout inset background"), "greyedoutbg", Linen, "greyedoutbg" },
 	{ Color_phantomtext, N_("phantom inset text"), "phantomtext", "#7f7f7f", "phantomtext" },
 	{ Color_shadedbg, N_("shaded box"), "shaded", "#ff0000", "shaded" },
-	{ Color_listingsbg, N_("listings background"), "listingsbg", "white", "listingsbg" },
+	{ Color_listingsbg, N_("listings background"), "listingsbg", white, "listingsbg" },
 	{ Color_branchlabel, N_("branch label"), "branchlabel", "#c88000", "branchlabel" },
 	{ Color_footlabel, N_("footnote label"), "footlabel", "#00aaff", "footlabel" },
-	{ Color_indexlabel, N_("index label"), "indexlabel", "green", "indexlabel" },
+	{ Color_indexlabel, N_("index label"), "indexlabel", Green, "indexlabel" },
 	{ Color_marginlabel, N_("margin note label"), "marginlabel", "#aa55ff", "marginlabel" },
-	{ Color_urllabel, N_("URL label"), "urllabel", "blue", "urllabel" },
-	{ Color_urltext, N_("URL text"), "urltext", "blue", "urltext" },
-	{ Color_depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" },
-	{ Color_scroll, N_("scroll indicator"), "scroll", "IndianRed", "scroll" },
-	{ Color_language, N_("language"), "language", "Blue", "language" },
-	{ Color_command, N_("command inset"), "command", "black", "command" },
-	{ Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
-	{ Color_commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
-	{ Color_command_broken, N_("command inset (broken reference)"), "command", "white", "command_broken" },
-	{ Color_buttonbg_broken, N_("button background (broken reference)"), "commandbg", "Red", "commandbg_broken" },
-	{ Color_buttonframe_broken, N_("button frame (broken reference)"), "commandframe", "Red", "commandframe_broken" },
+	{ Color_urllabel, N_("URL label"), "urllabel", blue, "urllabel" },
+	{ Color_urltext, N_("URL text"), "urltext", blue, "urltext" },
+	{ Color_depthbar, N_("depth bar"), "depthbar", IndianRed, "depthbar" },
+	{ Color_scroll, N_("scroll indicator"), "scroll", IndianRed, "scroll" },
+	{ Color_language, N_("language"), "language", blue, "language" },
+	{ Color_command, N_("command inset"), "command", black, "command" },
+	{ Color_commandbg, N_("command inset background"), "commandbg", "#f0ffff", "commandbg" },
+	{ Color_commandframe, N_("command inset frame"), "commandframe", black, "commandframe" },
+	{ Color_command_broken, N_("command inset (broken reference)"), "command", white, "command_broken" },
+	{ Color_buttonbg_broken, N_("button background (broken reference)"), "commandbg", red, "commandbg_broken" },
+	{ Color_buttonframe_broken, N_("button frame (broken reference)"), "commandframe", red, "commandframe_broken" },
 	{ Color_buttonhoverbg_broken, N_("button background (broken reference) under focus"), "buttonhoverbg", "#DB0B0B", "buttonhoverbg_broken" },
-	{ Color_special, N_("special character"), "special", "RoyalBlue", "special" },
-	{ Color_math, N_("math"), "math", "DarkBlue", "math" },
-	{ Color_mathbg, N_("math background"), "mathbg", "linen", "mathbg" },
-	{ Color_graphicsbg, N_("graphics background"), "graphicsbg", "linen", "graphicsbg" },
-	{ Color_mathmacrobg, N_("math macro background"), "mathmacrobg", "linen", "mathmacrobg" },
-	{ Color_mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" },
-	{ Color_mathcorners, N_("math corners"), "mathcorners", "linen", "mathcorners" },
-	{ Color_mathline, N_("math line"), "mathline", "Blue", "mathline" },
+	{ Color_special, N_("special character"), "special", RoyalBlue, "special" },
+	{ Color_math, N_("math"), "math", "#00008B", "math" },
+	{ Color_mathbg, N_("math background"), "mathbg", Linen, "mathbg" },
+	{ Color_graphicsbg, N_("graphics background"), "graphicsbg", Linen, "graphicsbg" },
+	{ Color_mathmacrobg, N_("math macro background"), "mathmacrobg", Linen, "mathmacrobg" },
+	{ Color_mathframe, N_("math frame"), "mathframe", magenta, "mathframe" },
+	{ Color_mathcorners, N_("math corners"), "mathcorners", Linen, "mathcorners" },
+	{ Color_mathline, N_("math line"), "mathline", blue, "mathline" },
 	{ Color_mathmacrobg, N_("math macro background"), "mathmacrobg", "#ede2d8", "mathmacrobg" },
 	{ Color_mathmacrohoverbg, N_("math macro hovered background"), "mathmacrohoverbg", "#cdc3b8", "mathmacrohoverbg" },
 	{ Color_mathmacrolabel, N_("math macro label"), "mathmacrolabel", "#a19992", "mathmacrolabel" },
 	{ Color_mathmacroframe, N_("math macro frame"), "mathmacroframe", "#ede2d8", "mathmacroframe" },
-	{ Color_mathmacroblend, N_("math macro blended out"), "mathmacroblend", "black", "mathmacroblend" },
+	{ Color_mathmacroblend, N_("math macro blended out"), "mathmacroblend", black, "mathmacroblend" },
 	{ Color_mathmacrooldarg, N_("math macro old parameter"), "mathmacrooldarg", grey80, "mathmacrooldarg" },
-	{ Color_mathmacronewarg, N_("math macro new parameter"), "mathmacronewarg", "black", "mathmacronewarg" },
-	{ Color_collapsible, N_("collapsible inset text"), "collapsible", "DarkRed", "collapsible" },
-	{ Color_collapsibleframe, N_("collapsible inset frame"), "collapsibleframe", "IndianRed", "collapsibleframe" },
+	{ Color_mathmacronewarg, N_("math macro new parameter"), "mathmacronewarg", black, "mathmacronewarg" },
+	{ Color_collapsible, N_("collapsible inset text"), "collapsible", DarkRed, "collapsible" },
+	{ Color_collapsibleframe, N_("collapsible inset frame"), "collapsibleframe", IndianRed, "collapsibleframe" },
 	{ Color_insetbg, N_("inset background"), "insetbg", grey80, "insetbg" },
-	{ Color_insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" },
-	{ Color_error, N_("LaTeX error"), "error", "Red", "error" },
-	{ Color_eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" },
-	{ Color_appendix, N_("appendix marker"), "appendix", "Brown", "appendix" },
-	{ Color_changebar, N_("change bar"), "changebar", "Blue", "changebar" },
+	{ Color_insetframe, N_("inset frame"), "insetframe", IndianRed, "insetframe" },
+	{ Color_error, N_("LaTeX error"), "error", red, "error" },
+	{ Color_eolmarker, N_("end-of-line marker"), "eolmarker", Brown, "eolmarker" },
+	{ Color_appendix, N_("appendix marker"), "appendix", Brown, "appendix" },
+	{ Color_changebar, N_("change bar"), "changebar", blue, "changebar" },
 	{ Color_deletedtext, N_("deleted text (output)"), "deletedtext", "#ff0000", "deletedtext" },
 	{ Color_addedtext, N_("added text (output)"), "addedtext", "#0000ff", "addedtext" },
 	{ Color_addedtextauthor1, N_("added text (workarea, 1st author)"), "changedtextauthor1", "#0000ff", "changedtextauthor1" },
@@ -288,21 +315,21 @@ ColorSet::ColorSet()
 	{ Color_addedtextauthor3, N_("added text (workarea, 3rd author)"), "changedtextauthor3", "#ff0000", "changedtextauthor3" },
 	{ Color_addedtextauthor4, N_("added text (workarea, 4th author)"), "changedtextauthor4", "#aa00ff", "changedtextauthor4" },
 	{ Color_addedtextauthor5, N_("added text (workarea, 5th author)"), "changedtextauthor5", "#55aa00", "changedtextauthor5" },
-	{ Color_deletedtextmodifier, N_("deleted text modifier (workarea)"), "deletedtextmodifier", "white", "deletedtextmodifier" },
-	{ Color_added_space, N_("added space markers"), "added_space", "Brown", "added_space" },
-	{ Color_tabularline, N_("table line"), "tabularline", "black", "tabularline" },
-	{ Color_tabularonoffline, N_("table on/off line"), "tabularonoffline", "LightSteelBlue", "tabularonoffline" },
+	{ Color_deletedtextmodifier, N_("deleted text modifier (workarea)"), "deletedtextmodifier", white, "deletedtextmodifier" },
+	{ Color_added_space, N_("added space markers"), "added_space", Brown, "added_space" },
+	{ Color_tabularline, N_("table line"), "tabularline", black, "tabularline" },
+	{ Color_tabularonoffline, N_("table on/off line"), "tabularonoffline", "#b0c4de", "tabularonoffline" },
 	{ Color_bottomarea, N_("bottom area"), "bottomarea", grey40, "bottomarea" },
-	{ Color_newpage, N_("new page"), "newpage", "Blue", "newpage" },
-	{ Color_pagebreak, N_("page break / line break"), "pagebreak", "RoyalBlue", "pagebreak" },
+	{ Color_newpage, N_("new page"), "newpage", blue, "newpage" },
+	{ Color_pagebreak, N_("page break / line break"), "pagebreak", RoyalBlue, "pagebreak" },
 	{ Color_buttonframe, N_("button frame"), "buttonframe", "#dcd2c8", "buttonframe" },
 	{ Color_buttonbg, N_("button background"), "buttonbg", "#dcd2c8", "buttonbg" },
 	{ Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "buttonhoverbg" },
 	{ Color_paragraphmarker, N_("paragraph marker"), "paragraphmarker", grey80, "paragraphmarker"},
-	{ Color_previewframe, N_("preview frame"), "previewframe", "black", "previewframe"},
-	{ Color_inherit, N_("inherit"), "inherit", "black", "inherit" },
-	{ Color_regexpframe, N_("regexp frame"), "regexpframe", "green", "regexpframe" },
-	{ Color_ignore, N_("ignore"), "ignore", "black", "ignore" },
+	{ Color_previewframe, N_("preview frame"), "previewframe", black, "previewframe"},
+	{ Color_inherit, N_("inherit"), "inherit", black, "inherit" },
+	{ Color_regexpframe, N_("regexp frame"), "regexpframe", Green, "regexpframe" },
+	{ Color_ignore, N_("ignore"), "ignore", black, "ignore" },
 	{ Color_ignore, nullptr, nullptr, nullptr, nullptr }
 	};
 
@@ -317,7 +344,7 @@ void ColorSet::fill(ColorEntry const & entry)
 	Information in;
 	in.lyxname   = entry.lyxname;
 	in.latexname = entry.latexname;
-	in.x11name   = entry.x11name;
+	in.x11hexname   = entry.x11hexname;
 	in.guiname   = entry.guiname;
 	infotab[entry.lcolor] = in;
 	lyxcolors[entry.lyxname] = entry.lcolor;
@@ -334,11 +361,11 @@ docstring const ColorSet::getGUIName(ColorCode c) const
 }
 
 
-string const ColorSet::getX11Name(ColorCode c) const
+string const ColorSet::getX11HexName(ColorCode c) const
 {
 	InfoTab::const_iterator it = infotab.find(c);
 	if (it != infotab.end())
-		return it->second.x11name;
+		return it->second.x11hexname;
 
 	lyxerr << "LyX internal error: Missing color"
 		  " entry in Color.cpp for " << c << '\n'
@@ -365,7 +392,7 @@ string const ColorSet::getLyXName(ColorCode c) const
 }
 
 
-bool ColorSet::setColor(ColorCode col, string const & x11name)
+bool ColorSet::setColor(ColorCode col, string const & x11hexname)
 {
 	InfoTab::iterator it = infotab.find(col);
 	if (it == infotab.end()) {
@@ -380,12 +407,12 @@ bool ColorSet::setColor(ColorCode col, string const & x11name)
 		return false;
 	}
 
-	it->second.x11name = x11name;
+	it->second.x11hexname = x11hexname;
 	return true;
 }
 
 
-bool ColorSet::setColor(string const & lyxname, string const &x11name)
+bool ColorSet::setColor(string const & lyxname, string const & x11hexname)
 {
 	string const lcname = ascii_lowercase(lyxname);
 	if (lyxcolors.find(lcname) == lyxcolors.end()) {
@@ -394,7 +421,7 @@ bool ColorSet::setColor(string const & lyxname, string const &x11name)
 		addColor(static_cast<ColorCode>(infotab.size()), lcname);
 	}
 
-	return setColor(lyxcolors[lcname], x11name);
+	return setColor(lyxcolors[lcname], x11hexname);
 }
 
 
diff --git a/src/ColorSet.h b/src/ColorSet.h
index 2e49d07..31e9312 100644
--- a/src/ColorSet.h
+++ b/src/ColorSet.h
@@ -48,22 +48,22 @@ public:
 	///
 	ColorSet();
 
-	/** set the given LyX color to the color defined by the X11 name given
+	/** set the given LyX color to the color defined by the X11 hex name given
 	 *  \returns true if successful.
 	 */
-	bool setColor(ColorCode col, std::string const & x11name);
+	bool setColor(ColorCode col, std::string const & x11hexname);
 
 	/** set the given LyX color to the color defined by the X11
-	 *  name given \returns true if successful. A new color entry
+	 *  hex name given \returns true if successful. A new color entry
 	 *  is created if the color is unknown
 	 */
-	bool setColor(std::string const & lyxname, std::string const & x11name);
+	bool setColor(std::string const & lyxname, std::string const & x11hexname);
 
 	/// Get the GUI name of \c color.
 	docstring const getGUIName(ColorCode c) const;
 
-	/// Get the X11 name of \c color.
-	std::string const getX11Name(ColorCode c) const;
+	/// Get the X11 hexname of \c color.
+	std::string const getX11HexName(ColorCode c) const;
 
 	/// Get the LaTeX name of \c color.
 	std::string const getLaTeXName(ColorCode c) const;
@@ -87,7 +87,7 @@ private:
 		/// the name used in LaTeX
 		std::string latexname;
 		/// the name for X11
-		std::string x11name;
+		std::string x11hexname;
 		/// the name for LyX
 		std::string lyxname;
 	};
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index 256b0d8..4f3b878 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -1735,11 +1735,11 @@ TexString LaTeXFeatures::getMacros() const
 	if (mustProvide("ct-xcolor-ulem")) {
 		streamsize const prec = macros.os().precision(2);
 
-		RGBColor cadd = rgbFromHexName(lcolor.getX11Name(Color_addedtext));
+		RGBColor cadd = rgbFromHexName(lcolor.getX11HexName(Color_addedtext));
 		macros << "\\providecolor{lyxadded}{rgb}{"
 		       << cadd.r / 255.0 << ',' << cadd.g / 255.0 << ',' << cadd.b / 255.0 << "}\n";
 
-		RGBColor cdel = rgbFromHexName(lcolor.getX11Name(Color_deletedtext));
+		RGBColor cdel = rgbFromHexName(lcolor.getX11HexName(Color_deletedtext));
 		macros << "\\providecolor{lyxdeleted}{rgb}{"
 		       << cdel.r / 255.0 << ',' << cdel.g / 255.0 << ',' << cdel.b / 255.0 << "}\n";
 
@@ -1764,11 +1764,11 @@ TexString LaTeXFeatures::getMacros() const
 		if (!mustProvide("ct-xcolor-ulem")) {
 			streamsize const prec = macros.os().precision(2);
 
-			RGBColor cadd = rgbFromHexName(lcolor.getX11Name(Color_addedtext));
+			RGBColor cadd = rgbFromHexName(lcolor.getX11HexName(Color_addedtext));
 			macros << "\\providecolor{lyxadded}{rgb}{"
 			       << cadd.r / 255.0 << ',' << cadd.g / 255.0 << ',' << cadd.b / 255.0 << "}\n";
 	
-			RGBColor cdel = rgbFromHexName(lcolor.getX11Name(Color_deletedtext));
+			RGBColor cdel = rgbFromHexName(lcolor.getX11HexName(Color_deletedtext));
 			macros << "\\providecolor{lyxdeleted}{rgb}{"
 			       << cdel.r / 255.0 << ',' << cdel.g / 255.0 << ',' << cdel.b / 255.0 << "}\n";
 	
diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp
index 42df207..328e683 100644
--- a/src/LyXRC.cpp
+++ b/src/LyXRC.cpp
@@ -1937,9 +1937,9 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
 	case RC_SET_COLOR:
 		for (int i = 0; i < Color_ignore; ++i) {
 			ColorCode lc = static_cast<ColorCode>(i);
-			string const col = lcolor.getX11Name(lc);
+			string const col = lcolor.getX11HexName(lc);
 			if (ignore_system_lyxrc
-			    || col != system_lcolor.getX11Name(lc)) {
+			    || col != system_lcolor.getX11HexName(lc)) {
 				os << "\\set_color \""
 				   << lcolor.getLyXName(lc) << "\" \""
 				   << col << "\"\n";
diff --git a/src/frontends/qt/ColorCache.cpp b/src/frontends/qt/ColorCache.cpp
index 6036099..81ac138 100644
--- a/src/frontends/qt/ColorCache.cpp
+++ b/src/frontends/qt/ColorCache.cpp
@@ -60,7 +60,7 @@ QPalette::ColorRole role(ColorCode col)
 void ColorCache::init()
 {
 	for (int col = 0; col <= Color_ignore; ++col) {
-		lcolors_[col] = QColor(lcolor.getX11Name(ColorCode(col)).c_str());
+		lcolors_[col] = QColor(lcolor.getX11HexName(ColorCode(col)).c_str());
 	}
 
 	initialized_ = true;
@@ -102,7 +102,7 @@ QColor ColorCache::get(Color const & color, bool syscolors) const
 			(base_color.blue() + merge_color.blue()) / 2);
 	}
 	// used by branches
-	return QColor(lcolor.getX11Name(color.baseColor).c_str());
+	return QColor(lcolor.getX11HexName(color.baseColor).c_str());
 }
 
 
diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index 213321f..76cf364 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -2836,7 +2836,7 @@ bool GuiApplication::getRgbColor(ColorCode col, RGBColor & rgbcol)
 
 bool Application::getRgbColorUncached(ColorCode col, RGBColor & rgbcol)
 {
-	QColor const qcol(lcolor.getX11Name(col).c_str());
+	QColor const qcol(lcolor.getX11HexName(col).c_str());
 	if (!qcol.isValid()) {
 		rgbcol.r = 0;
 		rgbcol.g = 0;
diff --git a/src/frontends/qt/GuiPrefs.cpp b/src/frontends/qt/GuiPrefs.cpp
index 98aa0c1..c8d2191 100644
--- a/src/frontends/qt/GuiPrefs.cpp
+++ b/src/frontends/qt/GuiPrefs.cpp
@@ -1254,7 +1254,7 @@ bool PrefColors::isDefaultColor(int const row, QString const color)
 QColor PrefColors::getDefaultColorByRow(int const row)
 {
 	ColorSet const defaultcolor;
-	return defaultcolor.getX11Name(lcolors_[size_t(row)]).c_str();
+	return defaultcolor.getX11HexName(lcolors_[size_t(row)]).c_str();
 }
 
 
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index d0e11fe..068854b 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -604,7 +604,7 @@ void InsetMathHull::drawMarkers(PainterInfo & pi, int x, int y) const
 	ColorCode pen_color = mouseHovered(pi.base.bv) || editing(pi.base.bv)?
 		Color_mathframe : Color_mathcorners;
 	// If the corners have the same color as the background, do not paint them.
-	if (lcolor.getX11Name(Color_mathbg) == lcolor.getX11Name(pen_color))
+	if (lcolor.getX11HexName(Color_mathbg) == lcolor.getX11HexName(pen_color))
 		return;
 
 	Inset::drawMarkers(pi, x, y);
diff --git a/src/mathed/MathRow.cpp b/src/mathed/MathRow.cpp
index d66d0d3..d78815a 100644
--- a/src/mathed/MathRow.cpp
+++ b/src/mathed/MathRow.cpp
@@ -123,7 +123,7 @@ void drawMarkers(PainterInfo const & pi, MathRow::Element const & e,
 	                       || e.inset->editing(pi.base.bv);
 	ColorCode const pen_color = highlight ? Color_mathframe : Color_mathcorners;
 	// If the corners have the same color as the background, do not paint them.
-	if (lcolor.getX11Name(Color_mathbg) == lcolor.getX11Name(pen_color))
+	if (lcolor.getX11HexName(Color_mathbg) == lcolor.getX11HexName(pen_color))
 		return;
 
 	// Lower corners in all cases


More information about the lyx-cvs mailing list