19namespace Experimental {
35 using RGB_t = std::array<uint8_t, 3>;
41 static std::string
toHex(uint8_t
v);
56 RColor(uint8_t
r, uint8_t
g, uint8_t
b,
float alpha)
83 void SetRGB(uint8_t
r, uint8_t
g, uint8_t
b);
86 void SetRGBA(uint8_t
r, uint8_t
g, uint8_t
b, uint8_t alpha);
106 std::vector<uint8_t>
AsRGBA()
const;
112 return rgba.size() > 2 ? rgba[0] : 0;
119 return rgba.size() > 2 ? rgba[1] : 0;
126 return rgba.size() > 2 ? rgba[2] : 0;
133 return rgba.size() > 3 ? rgba[3] : 0xFF;
163 bool GetHLS(
float &hue,
float &light,
float &satur)
const;
166 void SetHLS(
float hue,
float light,
float satur);
168 std::string
AsHex(
bool with_alpha =
false)
const;
169 std::string
AsSVG()
const;
205 return !
l.empty() && (
l ==
r);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
static std::vector< uint8_t > ConvertNameToRGB(const std::string &name)
Converts string name of color in RGB value - when possible.
static R__DLLEXPORT constexpr RGB_t kRed
static R__DLLEXPORT constexpr RGB_t kLime
friend bool operator==(const RColor &lhs, const RColor &rhs)
bool IsOrdinal() const
Returns if color codes ordinal value from palette.
void SetRGB(const RGB_t &rgb)
Set r/g/b components of color.
std::string fColor
string representation of color
static R__DLLEXPORT constexpr RGB_t kYellow
void SetOrdinal(float val)
Set color as ordinal value from RPalette When object will be painted on the client side,...
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.
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
RColor(float ordinal)
Construct color with provided ordinal value
std::vector< uint8_t > AsRGBA() const
Returns color as RGBA array, trying also convert color name into RGBA value.
static const RColor & AutoColor()
Set the color value from the Hue, Light, Saturation (HLS).
static R__DLLEXPORT constexpr RGB_t kFuchsia
bool SetName(const std::string &name)
Set color as plain SVG name like "white" or "lightblue".
static R__DLLEXPORT constexpr RGB_t kWhite
bool IsRGBA() const
returns true if color stored as RGBA
bool SetAlphaHex(const std::string &hex)
Set Alpha value as hex.
bool IsEmpty() const
Returns true if color is empty.
RColor(const RGB_t &rgb)
Construct color with provided RGB_t value.
void SetAlpha(uint8_t alpha)
Set alpha as value from range 0..255.
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
bool IsName() const
Returns true if color specified as name.
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.
void SetColor(const std::string &col)
Set color as string.
static R__DLLEXPORT constexpr float kTransparent
const std::string & AsString() const
Returns color as it stored as string.
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
float GetOrdinal() const
Return ordinal value, which was set before with SetOrdinal() call.
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.
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
bool IsRGB() const
returns true if color stored as RGB
RColor(const std::string &color)
Construct color with provided string
void SetRGBA(uint8_t r, uint8_t g, uint8_t b, uint8_t alpha)
Set r/g/b/a components of color, a is integer between 0..255.
bool IsAuto() const
Returns true if color specified as auto color.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.