4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Asger Alstrup
8 * \author Lars Gullik Bjønnes
9 * \author Matthias Ettrich
10 * \author Jean-Marc Lasgouttes
11 * \author Angus Leeming
13 * \author André Pönitz
14 * \author Martin Vermeer
16 * Full author contact details are available in file CREDITS.
32 * A class holding color definitions and associated names for
33 * LaTeX, X11, the GUI, and LyX internally.
35 * A color can be one of the following kinds:
37 * - A real, predefined color, such as black, white, red or green.
38 * - A logical color, such as no color, inherit, math
42 // made copyable for same reasons as LyXRC was made copyable. See there for
51 /** set the given LyX color to the color defined by the X11 hex name given
52 * \returns true if successful. The optional third argument passes
53 * a color for dark mode.
55 bool setColor(ColorCode col, std::string const & x11hexname,
56 std::string const & x11darkhexname = std::string());
58 /** set the given LyX color to the color defined by the X11
59 * hex name given \returns true if successful. A new color entry
60 * is created if the color is unknown. The optional third argument passes
61 * a color for dark mode.
63 bool setColor(std::string const & lyxname, std::string const & x11hexname,
64 std::string const & x11darkhexname = std::string());
66 /// Get the GUI name of \c color.
67 docstring const getGUIName(ColorCode c) const;
69 /// Get the X11 hexname of \c color.
70 std::string const getX11HexName(ColorCode c, bool const darkmode = false) const;
72 /// Get the X11 hexname of \c color.
73 std::pair<std::string, std::string> const getAllX11HexNames(ColorCode c) const;
75 /// Get the LaTeX name of \c color.
76 std::string const getLaTeXName(ColorCode c) const;
78 /// Get the LyX name of \c color.
79 std::string const getLyXName(ColorCode c) const;
81 /// \returns the ColorCode associated with the LyX name.
82 ColorCode getFromLyXName(std::string const & lyxname) const;
83 /// \returns the ColorCode associated with the LaTeX name.
84 ColorCode getFromLaTeXName(std::string const & latexname) const;
88 void addColor(ColorCode c, std::string const & lyxname);
92 /// the name as it appears in the GUI
94 /// the name used in LaTeX
95 std::string latexname;
97 std::string x11hexname;
98 /// matching X11 color for dark mode
99 std::string x11darkhexname;
104 /// initialise a color entry
106 void fill(ColorEntry const & entry);
109 typedef std::map<ColorCode, Information> InfoTab;
110 /// the table of color Information
113 typedef std::map<std::string, ColorCode> Transform;
114 /// the transform between LyX color name string and integer code.
116 /// the transform between LaTeX color name string and integer code.
117 Transform latexcolors;
121 /// the current color definitions
122 extern ColorSet lcolor;
123 /// the system color definitions
124 extern ColorSet system_lcolor;