Visual Servoing Platform  version 3.6.1 under development (2024-07-27)
vpColorBlindFriendlyPalette.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See https://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Palette of colors that is said to be color-blind people friendly.
33  * This palette has been found on https://jfly.uni-koeln.de/color/#see
34  *
35 *****************************************************************************/
36 
37 #ifndef _vpColorBlindFliendlyPalette_h_
38 #define _vpColorBlindFliendlyPalette_h_
39 
40 #include <iostream>
41 
42 #include <visp3/core/vpConfig.h>
43 #include <visp3/core/vpColor.h>
44 
45 #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
51 class VISP_EXPORT vpColorBlindFriendlyPalette
52 {
53 public:
57  typedef enum class Palette
58  {
59  Black = 0,
60  Orange = 1,
61  SkyBlue = 2,
62  Green = 3,
63  Yellow = 4,
64  Blue = 5,
65  Vermillon = 6,
66  Purple = 7,
67  COUNT = 8
68  }Palette;
69 
70  static std::vector<std::string> s_paletteNames;
78 
85  vpColorBlindFriendlyPalette(const Palette &colorID);
86 
93  vpColorBlindFriendlyPalette(const std::string &nameColor);
94 
100  Palette get_colorID() const;
101 
108  vpColor to_vpColor() const;
109 
117  std::vector<unsigned char> to_RGB() const;
118 
128  std::vector<double> to_colorRatio() const;
129 
137  bool set_fromString(const std::string &nameColor);
138 
144  std::string to_string() const;
145 
154  static std::string getAvailableColorsNames(const std::string &prefix = "", const std::string &separator = " ", const std::string &suffix = "");
155 private:
156  static std::vector<vpColor> s_palette;
165  static unsigned int to_uint(const Palette &colorID);
166 
174  static std::string to_string(const Palette &colorID);
175 
176  Palette m_colorID;
177 };
178 END_VISP_NAMESPACE
179 
187  std::ostream &operator<<(std::ostream &os, const VISP_NAMESPACE_ADDRESSING vpColorBlindFriendlyPalette &color);
188 
197 std::istream &operator>>(std::istream &is, VISP_NAMESPACE_ADDRESSING vpColorBlindFriendlyPalette &color);
198 
199 #endif
200 #endif // _vpColorBlindFliendlyPalette_h_
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition: vpArray2D.h:611
Class that furnishes a set of colors that color blind people should be able to distinguish one from a...
Palette
Enum that list the different available colors.
static std::vector< std::string > s_paletteNames
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:157