named_colors.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2020, Locus Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef COLOR_UTIL_NAMED_COLORS_H
36 #define COLOR_UTIL_NAMED_COLORS_H
37 
38 #include <color_util/types.h>
39 #include <vector>
40 
41 namespace color_util
42 {
43 enum class NamedColor
44 {
46 
47  RED,
48  GREEN,
49  YELLOW,
50  BLUE,
51  ORANGE,
52  PURPLE,
53  CYAN,
54  MAGENTA,
55  LIME,
56  PINK,
57  TEAL,
58  LAVENDER,
59  BROWN,
60  MAROON,
61  MINT,
62  OLIVE,
63  NAVY,
64  GREY,
65 
66  LIGHT_RED,
69  LIGHT_BLUE,
72  LIGHT_CYAN,
74  LIGHT_LIME,
75  LIGHT_PINK,
76  LIGHT_TEAL,
80  LIGHT_MINT,
82  LIGHT_NAVY,
83  LIGHT_GREY,
84 
85  DARK_RED,
86  DARK_GREEN,
88  DARK_BLUE,
91  DARK_CYAN,
93  DARK_LIME,
94  DARK_PINK,
95  DARK_TEAL,
97  DARK_BROWN,
99  DARK_MINT,
100  DARK_OLIVE,
101  DARK_NAVY,
102  DARK_GREY,
103 };
104 
105 inline const std::vector<ColorRGBA24>& getNamedColors()
106 {
107  // Source: Slightly modified from https://sashat.me/2017/01/11/list-of-20-simple-distinct-colors/
108  static const std::vector<ColorRGBA24> colors =
109  {
110  ColorRGBA24(0x00, 0x00, 0x00, 0x00), // transparent
111 
112  ColorRGBA24(0xe6, 0x19, 0x4B), // #e6194B red
113  ColorRGBA24(0x3c, 0xb4, 0x4b), // #3cb44b green
114  ColorRGBA24(0xff, 0xe1, 0x19), // #ffe119 yellow
115  ColorRGBA24(0x43, 0x63, 0xd8), // #4363d8 blue
116  ColorRGBA24(0xf5, 0x82, 0x31), // #f58231 orange
117  ColorRGBA24(0x91, 0x1e, 0xb4), // #911eb4 purple
118  ColorRGBA24(0x42, 0xd4, 0xf4), // #42d4f4 cyan
119  ColorRGBA24(0xf0, 0x32, 0xe6), // #f032e6 magenta
120  ColorRGBA24(0xbf, 0xef, 0x45), // #bfef45 lime
121  ColorRGBA24(0xFB, 0x19, 0x7B), // #FB197B pink
122  ColorRGBA24(0x46, 0x99, 0x90), // #469990 teal
123  ColorRGBA24(0xb8, 0x45, 0xff), // #b845ff lavender
124  ColorRGBA24(0x9A, 0x63, 0x24), // #9A6324 brown
125  ColorRGBA24(0x80, 0x00, 0x00), // #800000 maroon
126  ColorRGBA24(0x89, 0xcc, 0x9d), // #89cc9d mint
127  ColorRGBA24(0x95, 0x95, 0x47), // #959547 olive
128  ColorRGBA24(0x00, 0x00, 0x75), // #000075 navy
129  ColorRGBA24(0xa9, 0xa9, 0xa9), // #a9a9a9 grey
130 
131  ColorRGBA24(0xEA, 0x60, 0x82), // #EA6082 light red
132  ColorRGBA24(0x7A, 0xC1, 0x82), // #7AC182 light green
133  ColorRGBA24(0xFF, 0xFE, 0x95), // #FFFE95 light yellow
134  ColorRGBA24(0xB0, 0xBA, 0xDF), // #B0BADF light blue
135  ColorRGBA24(0xF7, 0xC8, 0xA8), // #F7C8A8 light orange
136  ColorRGBA24(0xB2, 0x7E, 0xC1), // #B27EC1 light purple
137  ColorRGBA24(0xB9, 0xEB, 0xF7), // #B9EBF7 light cyan
138  ColorRGBA24(0xF2, 0xA7, 0xEE), // #F2A7EE light magenta
139  ColorRGBA24(0xE2, 0xF2, 0xBB), // #E2F2BB light lime
140  ColorRGBA24(0xfa, 0x90, 0xbe), // #fa90be light pink
141  ColorRGBA24(0xAE, 0xE5, 0xDF), // #AEE5DF light teal
142  ColorRGBA24(0xe6, 0xbe, 0xff), // #e6beff light lavender
143  ColorRGBA24(0xAA, 0x93, 0x79), // #AA9379 light brown
144  ColorRGBA24(0xCC, 0x00, 0x00), // #CC0000 light maroon
145  ColorRGBA24(0xaa, 0xff, 0xc3), // #aaffc3 light mint
146  ColorRGBA24(0xCC, 0xCC, 0x00), // #CCCC00 light olive
147  ColorRGBA24(0x3A, 0x3A, 0xC2), // #3A3AC2 light navy
148  ColorRGBA24(0xDB, 0xDB, 0xDB), // #DBDBDB light grey
149 
150  ColorRGBA24(0x66, 0x0B, 0x22), // #660B22 dark red
151  ColorRGBA24(0x12, 0x36, 0x16), // #123616 dark green
152  ColorRGBA24(0x80, 0x70, 0x0D), // #80700D dark yellow
153  ColorRGBA24(0x1C, 0x29, 0x59), // #1C2959 dark blue
154  ColorRGBA24(0x75, 0x3F, 0x17), // #753F17 dark orange
155  ColorRGBA24(0x2B, 0x09, 0x36), // #2B0936 dark purple
156  ColorRGBA24(0x20, 0x66, 0x75), // #206675 dark cyan
157  ColorRGBA24(0x70, 0x18, 0x6C), // #70186C dark magenta
158  ColorRGBA24(0x5A, 0x70, 0x21), // #5A7021 dark lime
159  ColorRGBA24(0x7A, 0x47, 0x5D), // #7A475D dark pink
160  ColorRGBA24(0x2F, 0x66, 0x60), // #2F6660 dark teal
161  ColorRGBA24(0x73, 0x60, 0x80), // #736080 dark lavender
162  ColorRGBA24(0x66, 0x41, 0x17), // #664117 dark brown
163  ColorRGBA24(0x4D, 0x00, 0x00), // #4D0000 dark maroon
164  ColorRGBA24(0x2F, 0x80, 0x47), // #2F8047 dark mint
165  ColorRGBA24(0x80, 0x80, 0x00), // #808000 dark olive
166  ColorRGBA24(0x00, 0x00, 0x42), // #000042 dark navy
167  ColorRGBA24(0x75, 0x75, 0x75), // #757575 dark grey
168  };
169 
170  return colors;
171 }
172 
173 inline const ColorRGBA24& get(const NamedColor& name)
174 {
175  return getNamedColors()[static_cast<unsigned int>(name)];
176 }
177 
178 
179 } // namespace color_util
180 
181 #endif // COLOR_UTIL_NAMED_COLORS_H
const std::vector< ColorRGBA24 > & getNamedColors()
Definition: named_colors.h:105


color_util
Author(s):
autogenerated on Sun Jan 10 2021 04:08:24