Visual Servoing Platform  version 3.6.1 under development (2024-05-07)
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<visp3/core/vpConfig.h>
41 #include<visp3/core/vpColor.h>
42 
43 #if (VISP_CXX_STANDARD > VISP_CXX_STANDARD_98)
48 class VISP_EXPORT vpColorBlindFriendlyPalette
49 {
50 public:
54  typedef enum class Palette
55  {
56  Black = 0,
57  Orange = 1,
58  SkyBlue = 2,
59  Green = 3,
60  Yellow = 4,
61  Blue = 5,
62  Vermillon = 6,
63  Purple = 7,
64  COUNT = 8
65  }Palette;
66 
67  static std::vector<std::string> s_paletteNames;
75 
82  vpColorBlindFriendlyPalette(const Palette &colorID);
83 
90  vpColorBlindFriendlyPalette(const std::string &nameColor);
91 
97  Palette get_colorID() const;
98 
105  vpColor to_vpColor() const;
106 
114  std::vector<unsigned char> to_RGB() const;
115 
125  std::vector<double> to_colorRatio() const;
126 
134  bool set_fromString(const std::string &nameColor);
135 
141  std::string to_string() const;
142 
151  static std::string getAvailableColorsNames(const std::string &prefix = "", const std::string &separator = " ", const std::string &suffix = "");
152 private:
153  static std::vector<vpColor> s_palette;
162  static unsigned int to_uint(const Palette &colorID);
163 
171  static std::string to_string(const Palette &colorID);
172 
173  Palette m_colorID;
174 };
175 
183 std::ostream &operator<<(std::ostream &os, const vpColorBlindFriendlyPalette &color);
184 
193 std::istream &operator>>(std::istream &is, vpColorBlindFriendlyPalette &color);
194 
195 #endif
196 #endif // _vpColorBlindFliendlyPalette_h_
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition: vpArray2D.h:600
Class that furnishes a set of colors that color blind people should be able to distinguish one from a...
static std::vector< std::string > s_paletteNames
Palette
Enum that list the different available colors.
Class to define RGB colors available for display functionalities.
Definition: vpColor.h:152