19namespace Experimental {
39 using RGB_t = std::array<uint8_t, 3>;
48 static bool ConvertToRGB(
const std::string &
name, std::vector<uint8_t> &rgba);
109 else if (alpha >= 1.)
123 if (
fRGBA.size() < 4)
139 std::vector<uint8_t>
AsRGBA()
const;
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() > 2)
167 std::vector<uint8_t> rgb;
174 if (
fRGBA.size() > 0)
177 std::vector<uint8_t> rgba;
202 bool GetHLS(
float &hue,
float &light,
float &satur)
const;
205 void SetHLS(
float hue,
float light,
float satur);
207 std::string
AsHex(
bool with_alpha =
false)
const;
208 std::string
AsSVG()
const;
243 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 R__DLLEXPORT constexpr RGB_t kRed
static R__DLLEXPORT 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 R__DLLEXPORT 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 R__DLLEXPORT constexpr RGB_t kPurple
static R__DLLEXPORT constexpr float kOpaque
static R__DLLEXPORT 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 R__DLLEXPORT constexpr float kSemiTransparent
std::vector< uint8_t > AsRGBA() const
Returns color as RGBA array, trying also convert color name into RGBA value.
static R__DLLEXPORT constexpr RGB_t kFuchsia
static R__DLLEXPORT constexpr RGB_t kWhite
void SetRGBA(uint8_t r, uint8_t g, uint8_t b, float alpha)
Set r/g/b/a components of color.
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 R__DLLEXPORT constexpr RGB_t kGrey
static R__DLLEXPORT constexpr RGB_t kBlack
static R__DLLEXPORT constexpr RGB_t kTeal
static R__DLLEXPORT constexpr RGB_t kAqua
RColor(uint8_t r, uint8_t g, uint8_t b)
Construct color with provided r,g,b values.
static R__DLLEXPORT 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 R__DLLEXPORT constexpr RGB_t kBlue
static R__DLLEXPORT 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 R__DLLEXPORT constexpr RGB_t kOlive
bool HasAlpha() const
Returns true if color alpha (opacity) was specified.
static R__DLLEXPORT 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 R__DLLEXPORT 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...