5#ifndef INCLUDE_FIFECHAN_COLOR_HPP_
6#define INCLUDE_FIFECHAN_COLOR_HPP_
18#include "fifechan/platform.hpp"
72 explicit Color(
int hexColor);
85 explicit Color(std::string
const & colorString);
113 Color(uint8_t
r, uint8_t
g, uint8_t
b, uint8_t
a = 255);
310 friend std::ostream&
operator<<(std::ostream& out,
Color const & color);
335 void parseHex(std::string
const & hex);
346 void parseRGB(std::string
const & rgbString);
356 void parseRGBA(std::string
const & rgbaString);
369 static std::vector<int> parseColorComponents(std::string
const & colors,
bool withAlpha =
false);
uint8_t a
Alpha color component (0-255).
Color & operator+=(Color const &color)
Adds the RGB values of another color to this color.
Color toGrayScale() const
Converts the color to grayscale.
std::string toRGBString() const
Returns the color in the form "rgb(r,g,b)".
std::string toHexString() const
Returns the color as a hexadecimal string in the form "#RRGGBB".
friend std::ostream & operator<<(std::ostream &out, Color const &color)
Output operator for output.
std::string toRGBAString() const
Returns the color in the form "rgba(r,g,b,a)".
Color operator+(Color const &color) const
Adds the RGB values of two colors together.
Color lighten(float percentage) const
Lightens the color by a percentage.
Color & operator*=(float value)
Multiplies the RGB values of this color with a float value.
Color operator*(float value) const
Multiplies the RGB values of a color with a float value.
uint8_t b
Blue color component (0-255).
Color darken(float percentage) const
Darkens the color by a percentage.
bool operator==(Color const &color) const
Compares two colors.
uint8_t g
Green color component (0-255).
bool operator!=(Color const &color) const
Compares two colors.
Color operator-(Color const &color) const
Subtracts the RGB values of one color from another.
Color()=default
Constructor.
Color blendWith(Color const &other) const
Blends the color with another color using alpha blending.
uint8_t r
Red color component (0-255).
Color & operator-=(Color const &color)
Subtracts the RGB values of another color from this color.