| 12 | namespace matplot { |
| 13 | |
| 14 | std::string to_string(matplot::color c) { |
| 15 | switch (c) { |
| 16 | case color::blue: |
| 17 | return "blue"; |
| 18 | case color::black: |
| 19 | return "black"; |
| 20 | case color::red: |
| 21 | return "red"; |
| 22 | case color::green: |
| 23 | return "green"; |
| 24 | case color::yellow: |
| 25 | return "yellow"; |
| 26 | case color::cyan: |
| 27 | return "cyan"; |
| 28 | case color::magenta: |
| 29 | return "magenta"; |
| 30 | case color::white: |
| 31 | return "white"; |
| 32 | case color::none: |
| 33 | return "none"; |
| 34 | } |
| 35 | throw std::logic_error("colors::to_string: could not find a string for color"); |
| 36 | } |
| 37 | |
| 38 | matplot::color string_to_color(std::string_view s) { |
| 39 | if (s.size() == 1) { |
no outgoing calls