35 #include <visp3/gui/vpColorBlindFriendlyPalette.h>
36 #include <visp3/core/vpIoTools.h>
38 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
53 std::vector<vpColor> vpColorBlindFriendlyPalette::s_palette = {
90 return s_palette[
to_uint(m_colorID)];
96 std::vector<unsigned char> v_rgb;
97 v_rgb.push_back(color.
R);
98 v_rgb.push_back(color.
G);
99 v_rgb.push_back(color.
B);
106 std::vector<double> v_rgb;
107 v_rgb.push_back((
double)color.
R / 255.0);
108 v_rgb.push_back((
double)color.
G / 255.0);
109 v_rgb.push_back((
double)color.
B / 255.0);
116 std::string nameLowerCase = nameColor;
117 bool wasFound(
false);
120 if (
to_string(candidate) == nameLowerCase) {
121 m_colorID = candidate;
130 std::string nameColor =
to_string(m_colorID);
136 std::string list(prefix);
137 const unsigned int nbAvailableColors = (
unsigned int)
Palette::COUNT;
138 for (
unsigned int i = 0; i < nbAvailableColors - 1; i++) {
140 list += nameCandidateID + separator;
148 const unsigned int nbAvailableColors = (
unsigned int)
Palette::COUNT;
149 unsigned int ID = nbAvailableColors;
150 std::string nameSearchedColor =
to_string(colorID);
151 bool wasFound =
false;
152 for (
unsigned int i = 0; i < nbAvailableColors && !wasFound; i++) {
154 if (
to_string(candidate) == nameSearchedColor) {
164 std::string nameColor;
204 std::string nameColor;
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Class that furnishes a set of colors that color blind people should be able to distinguish one from a...
std::vector< unsigned char > to_RGB() const
Cast a vpColorBlindFriendlyPalette in a vector {R, G, B}. A vpColorBlindFriendlyPalette::Palette::COU...
static std::vector< std::string > s_paletteNames
Palette
Enum that list the different available colors.
std::string to_string() const
Get the name of the vpColorBlindFriendlyPalette object.
vpColor to_vpColor() const
Cast a vpColorBlindFriendlyPalette in a vpColor object. A vpColorBlindFriendlyPalette::Palette::COUNT...
static std::string getAvailableColorsNames(const std::string &prefix="", const std::string &separator=" ", const std::string &suffix="")
Get the list of available colors names.
bool set_fromString(const std::string &nameColor)
Set the fromString object.
std::vector< double > to_colorRatio() const
Cast the object in a vector of doubles that belong to the range [0; 1]. The initial R,...
Palette get_colorID() const
Get the vpColorBlindFriendlyPalette::Palette the object corresponds to.
vpColorBlindFriendlyPalette()
Construct a new vp Color Blind Friendly Palette. The default value vpColorBlindFriendlyPalette::Palet...
unsigned int to_uint() const
Cast the object into an unsigned int that matches the value of its _colorID member.
Class to define RGB colors available for display functionalities.
unsigned char B
Blue component.
unsigned char R
Red component.
unsigned char G
Green component.