4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Angus Leeming
9 * Full author contact details are available in file CREDITS.
12 /* structs RGBColor and HSVColor to enable simple conversion between
26 /** Given col, fills r, g, b in the range 0-255.
27 The function returns true if successful.
28 It returns false on failure and sets r, g, b to 0. */
29 bool getRGBColor(LColor_color col,
30 unsigned int & r, unsigned int & g, unsigned int & b);
33 /// returns a string of form #rrggbb, given an RGBColor struct
34 std::string const X11hexname(RGBColor const & col);
40 HSVColor() : h(0.0), s(0.0), v(0.0) {}
41 HSVColor(double hue, double sat, double val)
42 : h(hue), s(sat), v(val) {}
43 HSVColor(RGBColor const &);
50 RGBColor() : r(0), g(0), b(0) {}
51 RGBColor(unsigned int red, unsigned int green, unsigned int blue)
52 : r(red), g(green), b(blue) {}
53 RGBColor(HSVColor const &);
54 /// \param x11hexname is of the form "#ffa071"
55 RGBColor(std::string const & x11hexname);
58 struct NamedColor : public RGBColor {
61 NamedColor() : RGBColor() {}
62 NamedColor(std::string const & lyx, std::string const & gui,
64 : RGBColor(c), lyxname(lyx), guiname(gui) {}
65 RGBColor const & color() const { return *this; }
69 bool operator==(RGBColor const & c1, RGBColor const & c2)
71 return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b);
76 bool operator!=(RGBColor const & c1, RGBColor const & c2)
81 } // namespace frontend