11#include <unordered_map>
15using namespace std::string_literals;
107 }
else if (val >= 1.) {
145 }
else if (
IsName() && (alpha != 0xFF)) {
161 static std::unordered_map<std::string,RGB_t>
known_colors = {
182 std::vector<uint8_t> res;
184 res[0] = known->second[0];
185 res[1] = known->second[1];
186 res[2] = known->second[2];
202 std::vector<uint8_t>
rgba;
211 rgba[0] = std::stoi(
fColor.substr(1,2),
nullptr, 16);
212 rgba[1] = std::stoi(
fColor.substr(3,2),
nullptr, 16);
213 rgba[2] = std::stoi(
fColor.substr(5,2),
nullptr, 16);
214 if (
rgba.size() == 4)
215 rgba[3] = std::stoi(
fColor.substr(7,2),
nullptr, 16);
235 auto digits = [](
auto d) {
return d < 10 ?
'0' +
d :
'A' - 10 +
d; };
236 std::string res(2,
'0');
248 if (hex.length() != 6)
return false;
251 SetRGB( std::stoi(hex.substr(0,2),
nullptr, 16),
252 std::stoi(hex.substr(2,2),
nullptr, 16),
253 std::stoi(hex.substr(4,2),
nullptr, 16));
265 if (hex.length() != 6)
return false;
267 SetAlpha(std::stoi(hex,
nullptr, 16));
364 SetRGB((uint8_t) (
rl*255.), (uint8_t) (
rl*255.), (uint8_t) (
rl*255.));
369 if (
h > 360)
h =
h - 360;
370 if (
h < 0)
h =
h + 360;
372 if (
h < 180)
return rm2;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
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 Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
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
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,...
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
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.
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 const RColor & AutoColor()
Set the color value from the Hue, Light, Saturation (HLS).
static R__DLLEXPORT constexpr RGB_t kFuchsia
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.
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
static R__DLLEXPORT constexpr float kTransparent
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.
static R__DLLEXPORT constexpr RGB_t kMaroon
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
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.
const_iterator end() const