MCPcopy Create free account
hub / github.com/alandefreitas/matplotplusplus / string_to_color

Function string_to_color

source/matplot/util/colors.cpp:38–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 }
37
38 matplot::color string_to_color(std::string_view s) {
39 if (s.size() == 1) {
40 return char_to_color(s[0]);
41 } else if (s == "blue") {
42 return color::blue;
43 } else if (s == "black") {
44 return color::black;
45 } else if (s == "red") {
46 return color::red;
47 } else if (s == "green") {
48 return color::green;
49 } else if (s == "yellow") {
50 return color::yellow;
51 } else if (s == "cyan") {
52 return color::cyan;
53 } else if (s == "magenta") {
54 return color::magenta;
55 } else if (s == "white") {
56 return color::white;
57 } else if (s == "none") {
58 return color::none;
59 } else {
60 return color::black;
61 }
62 }
63
64 matplot::color char_to_color(char c) {
65 switch (c) {

Callers 5

colorMethod · 0.85
colorMethod · 0.85
axis_type.cppFile · 0.85
colorMethod · 0.85
marker_colorMethod · 0.85

Calls 2

char_to_colorFunction · 0.85
sizeMethod · 0.45

Tested by 2

colorMethod · 0.68
marker_colorMethod · 0.68