}
+RGBColor const inverseRGBColor(RGBColor color)
+{
+ color.r = 255 - color.r;
+ color.g = 255 - color.g;
+ color.b = 255 - color.b;
+
+ return color;
+}
+
+
Color::Color(ColorCode base_color) : baseColor(base_color),
mergeColor(Color_ignore)
{}
{ Color_buttonhoverbg, N_("button background under focus"), "buttonhoverbg", "#C7C7CA", "#C7C7CA", "buttonhoverbg" },
{ Color_paragraphmarker, N_("paragraph marker"), "paragraphmarker", grey80, grey40, "paragraphmarker"},
{ Color_previewframe, N_("preview frame"), "previewframe", black, Linen, "previewframe"},
- { Color_inherit, N_("inherit"), "inherit", black, Linen, "inherit" },
{ Color_regexpframe, N_("regexp frame"), "regexpframe", Green, green, "regexpframe" },
+ { Color_bookmark, N_("bookmark"), "bookmark", RoyalBlue, RoyalBlue, "bookmark" },
+ { Color_inherit, N_("inherit"), "inherit", black, Linen, "inherit" },
{ Color_ignore, N_("ignore"), "ignore", black, Linen, "ignore" },
{ Color_ignore, nullptr, nullptr, nullptr, nullptr, nullptr }
};
}
+bool ColorSet::setLaTeXName(string const & lyxname, string const & latexname)
+{
+ string const lcname = ascii_lowercase(lyxname);
+ if (lyxcolors.find(lcname) == lyxcolors.end()) {
+ LYXERR(Debug::GUI, "ColorSet::setLaTeXName: Unknown color \""
+ << lyxname << '"');
+ addColor(static_cast<ColorCode>(infotab.size()), lcname);
+ }
+
+ 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 (!latexname.empty())
+ it->second.latexname = latexname;
+ return true;
+}
+
+
+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;
+}
+
+
void ColorSet::addColor(ColorCode c, string const & lyxname)
{
ColorEntry ce = { c, "", "", "", "", lyxname.c_str() };