+bool ColorSet::setGUIName(string const & lyxname, string const & guiname)
+{
+ string const lcname = ascii_lowercase(lyxname);
+ if (lyxcolors.find(lcname) == lyxcolors.end()) {
+ LYXERR(Debug::GUI, "ColorSet::setGUIName: Unknown color \""
+ << lyxname << '"');
+ return false;
+ }
+
+ ColorCode col = lyxcolors[lcname];
+ InfoTab::iterator it = infotab.find(col);
+ if (it == infotab.end()) {
+ LYXERR0("Color " << col << " not found in database.");
+ return false;
+ }
+
+ // "inherit" is returned for colors not in the database
+ // (and anyway should not be redefined)
+ if (col == Color_none || col == Color_inherit || col == Color_ignore) {
+ LYXERR0("Color " << getLyXName(col) << " may not be redefined.");
+ return false;
+ }
+
+ if (!guiname.empty())
+ it->second.guiname = guiname;
+ return true;
+}
+
+