18namespace Experimental {
38 using RGB_t = std::array<uint8_t, 3>;
47 static bool ConvertToRGB(
const std::string &
name, std::vector<uint8_t> &rgba);
113 if (
fRGBA.size() < 4)
129 std::vector<uint8_t>
AsRGBA()
const;
134 if (
fRGBA.size() > 2)
137 std::vector<uint8_t> rgb;
144 if (
fRGBA.size() > 2)
147 std::vector<uint8_t> rgb;
154 if (
fRGBA.size() > 2)
157 std::vector<uint8_t> rgb;
164 if (
fRGBA.size() > 0)
167 std::vector<uint8_t> rgba;
192 bool GetHLS(
float &hue,
float &light,
float &satur)
const;
195 void SetHLS(
float hue,
float light,
float satur);
197 std::string
AsHex(
bool with_alpha =
false)
const;
198 std::string
AsSVG()
const;
233 return !
l.empty() && (
l==
r);
Access RColor from drawable attributes.
void SetRGB(uint8_t r, uint8_t g, uint8_t b)
Set r/g/b components of color.
static constexpr RGB_t kRed
static constexpr RGB_t kLime
friend bool operator==(const RColor &lhs, const RColor &rhs)
RColor(const std::string &name)
Construct color with provided name.
void SetRGB(const RGB_t &rgb)
Set r/g/b components of color.
static bool ConvertToRGB(const std::string &name, std::vector< uint8_t > &rgba)
Converts string name of color in RGB value - when possible.
std::vector< uint8_t > fRGBA
RGB + Alpha.
static constexpr RGB_t kYellow
RColor(uint8_t r, uint8_t g, uint8_t b, float alpha)
Construct color with provided r,g,b and alpha values.
void SetHLS(float hue, float light, float satur)
Set the Red Green and Blue (RGB) values from the Hue, Light, Saturation (HLS).
static constexpr RGB_t kPurple
static constexpr float kOpaque
static constexpr RGB_t kGreen
uint8_t GetBlue() const
Returns blue color component 0..255.
bool GetHLS(float &hue, float &light, float &satur) const
Return the Hue, Light, Saturation (HLS) definition of this RColor.
std::string fName
name of color - if any
const std::string & GetName() const
Returns color as plain SVG name like "white" or "lightblue".
bool SetRGBHex(const std::string &hex)
Set RGB values as hex.
void SetAlphaFloat(float alpha)
Set alpha as float value from range 0..1.
static constexpr float kSemiTransparent
std::vector< uint8_t > AsRGBA() const
Returns color as RGBA array, trying also convert color name into RGBA value.
static constexpr RGB_t kFuchsia
static constexpr RGB_t kWhite
bool SetAlphaHex(const std::string &hex)
Set Alpha value as hex.
RColor & SetName(const std::string &name)
Set color as plain SVG name like "white" or "lightblue".
void SetRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha)
Set r/g/b/a components of color.
bool IsEmpty() const
Returns true if no color is specified.
RColor(const RGB_t &rgb)
Construct color with provided RGB_t value.
std::string AsSVG() const
Returns color value as it will be used in SVG drawing It either include hex format #66FF66 or just pl...
static constexpr RGB_t kGrey
static constexpr RGB_t kBlack
static constexpr RGB_t kTeal
static constexpr RGB_t kAqua
RColor(uint8_t r, uint8_t g, uint8_t b)
Construct color with provided r,g,b values.
static constexpr float kTransparent
uint8_t GetGreen() const
Returns green color component 0..255.
uint8_t GetAlpha() const
Returns color alpha (opacity) as uint8_t 0..255.
static constexpr RGB_t kBlue
static constexpr RGB_t kNavy
std::string AsHex(bool with_alpha=false) const
Returns color value in hex format like "66FF66" - without any prefix Alpha parameter can be optionall...
static constexpr RGB_t kOlive
bool HasAlpha() const
Returns true if color alpha (opacity) was specified.
static constexpr RGB_t kMaroon
uint8_t GetRed() const
Returns red color component 0..255.
void SetAlpha(uint8_t alpha)
Set alpha as value from range 0..255.
float GetAlphaFloat() const
Returns color alpha (opacity) as float from 0..1.
std::array< uint8_t, 3 > RGB_t
static std::string toHex(uint8_t v)
Converts integer from 0 to 255 into hex format with two digits like 00.
static constexpr RGB_t kSilver
const std::vector< uint8_t > & GetRGBA() const
Returns color as RGBA array - when exists.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...