| 72 | } |
| 73 | |
| 74 | NVGcolor fromHexString(std::string s) { |
| 75 | uint8_t r = 0; |
| 76 | uint8_t g = 0; |
| 77 | uint8_t b = 0; |
| 78 | uint8_t a = 255; |
| 79 | // If only three hex pairs are given, this will leave `a` unset. |
| 80 | sscanf(s.c_str(), "#%2hhx%2hhx%2hhx%2hhx", &r, &g, &b, &a); |
| 81 | return nvgRGBA(r, g, b, a); |
| 82 | } |
| 83 | |
| 84 | std::string toHexString(NVGcolor c) { |
| 85 | uint8_t r = std::round(c.r * 255); |
no outgoing calls
no test coverage detected