* \brief A class to handle colors * \bind{Color} */
| 11 | * \bind{Color} |
| 12 | */ |
| 13 | class Color |
| 14 | { |
| 15 | public: |
| 16 | double r = 0; |
| 17 | double g = 0; |
| 18 | double b = 0; |
| 19 | double a = 255; |
| 20 | |
| 21 | Color(); |
| 22 | Color(double r, double g, double b, double a = 255); |
| 23 | explicit Color(const std::string& nameOrHex); |
| 24 | Color(const Color& color); |
| 25 | Color(const sf::Color& color); |
| 26 | |
| 27 | void fromString(std::string string); |
| 28 | bool fromName(std::string name, bool strict = true); |
| 29 | void fromHex(std::string hexCode); |
| 30 | void fromRgb(double r, double g, double b, double a = 255); |
| 31 | void fromHsv(int H, double S, double V); |
| 32 | |
| 33 | [[nodiscard]] uint32_t toInteger() const; |
| 34 | |
| 35 | bool operator==(const Color& color) const; |
| 36 | bool operator!=(const Color& color) const; |
| 37 | Color operator+(const Color& color) const; |
| 38 | void operator+=(const Color& color); |
| 39 | Color operator-(const Color& color) const; |
| 40 | void operator-=(const Color& color); |
| 41 | Color operator*(const Color& color) const; |
| 42 | Color operator*(double value) const; |
| 43 | void operator*=(const Color& color); |
| 44 | void operator*=(double value); |
| 45 | Color operator/(const Color& color) const; |
| 46 | Color operator/(double value) const; |
| 47 | void operator/=(const Color& color); |
| 48 | void operator/=(double value); |
| 49 | Color operator-() const; |
| 50 | |
| 51 | operator sf::Color() const; |
| 52 | |
| 53 | static Color AliceBlue; |
| 54 | static Color AntiqueWhite; |
| 55 | static Color Aqua; |
| 56 | static Color Aquamarine; |
| 57 | static Color Azure; |
| 58 | static Color Beige; |
| 59 | static Color Bisque; |
| 60 | static Color Black; |
| 61 | static Color BlanchedAlmond; |
| 62 | static Color Blue; |
| 63 | static Color BlueViolet; |
| 64 | static Color Brown; |
| 65 | static Color BurlyWood; |
| 66 | static Color CadetBlue; |
| 67 | static Color Chartreuse; |
| 68 | static Color Chocolate; |
| 69 | static Color Coral; |
| 70 | static Color CornflowerBlue; |