X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FColor.h;h=b2a43b7784f7f34e7f42261625d1dcde1d0e22f6;hb=02703f47bfdb01dbe229d13ec02c9f567995f6ee;hp=c64ba1656643e35fb774412b7872f46e2a3eccb9;hpb=eefcedf31144aa78a9259aaa802b23b1289f0139;p=features.git diff --git a/src/Color.h b/src/Color.h index c64ba16566..b2a43b7784 100644 --- a/src/Color.h +++ b/src/Color.h @@ -251,6 +251,55 @@ extern Color lcolor; extern Color system_lcolor; +struct RGBColor; +/// returns a string of form #rrggbb, given an RGBColor struct +std::string const X11hexname(RGBColor const & col); + +struct HSVColor { + double h; + double s; + double v; + HSVColor() : h(0.0), s(0.0), v(0.0) {} + HSVColor(double hue, double sat, double val) + : h(hue), s(sat), v(val) {} + HSVColor(RGBColor const &); +}; + +struct RGBColor { + unsigned int r; + unsigned int g; + unsigned int b; + RGBColor() : r(0), g(0), b(0) {} + RGBColor(unsigned int red, unsigned int green, unsigned int blue) + : r(red), g(green), b(blue) {} + RGBColor(HSVColor const &); + /// \param x11hexname is of the form "#ffa071" + RGBColor(std::string const & x11hexname); +}; + +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; } +}; + +inline +bool operator==(RGBColor const & c1, RGBColor const & c2) +{ + return (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b); +} + + +inline +bool operator!=(RGBColor const & c1, RGBColor const & c2) +{ + return !(c1 == c2); +} + } // namespace lyx #endif