-struct NamedColor : public RGBColor {
- std::string lyxname;
- std::string guiname;
- NamedColor() : RGBColor() {}
- NamedColor(std::string const & lyx, std::string const & gui,
- RGBColor const & c)
- : RGBColor(c), lyxname(lyx), guiname(gui) {}
- RGBColor const & color() const { return *this; }
+ /** set the given LyX color to the color defined by the X11
+ * 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);
+
+ /// 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 LaTeX name of \c color.
+ std::string const getLaTeXName(ColorCode c) const;
+
+ /// Get the LyX name of \c color.
+ std::string const getLyXName(ColorCode c) const;
+
+ /// \returns the ColorCode associated with the LyX name.
+ ColorCode getFromLyXName(std::string const & lyxname) const;
+ /// \returns the ColorCode associated with the LaTeX name.
+ ColorCode getFromLaTeXName(std::string const & latexname) const;
+
+private:
+ ///
+ void addColor(ColorCode c, std::string const & lyxname);
+ ///
+ class Information {
+ public:
+ /// the name as it appears in the GUI
+ std::string guiname;
+ /// the name used in LaTeX
+ std::string latexname;
+ /// the name for X11
+ std::string x11name;
+ /// the name for LyX
+ std::string lyxname;
+ };
+
+ /// initialise a color entry
+ struct ColorEntry;
+ void fill(ColorEntry const & entry);
+
+ ///
+ typedef std::map<ColorCode, Information> InfoTab;
+ /// the table of color Information
+ InfoTab infotab;
+
+ typedef std::map<std::string, ColorCode> Transform;
+ /// the transform between LyX color name string and integer code.
+ Transform lyxcolors;
+ /// the transform between LaTeX color name string and integer code.
+ Transform latexcolors;