| 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) { |